mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: exclude moderator_action post for reply count in user summary. (#14991)
Previously, incorrect reply counts are displayed in the "top categories" section of the user summary page since we included the `moderator_action` and `small_action` post types. Co-authored-by: Alan Guo Xiang Tan <gxtan1990@gmail.com>
This commit is contained in:
@@ -78,4 +78,19 @@ describe UserSummary do
|
||||
expect(summary.top_categories.length).to eq(UserSummary::MAX_SUMMARY_RESULTS)
|
||||
expect(summary.top_categories.first[:id]).to eq(top_category.id)
|
||||
end
|
||||
|
||||
it "excludes moderator action posts" do
|
||||
topic = create_post.topic
|
||||
user = topic.user
|
||||
create_post(user: user, topic: topic)
|
||||
Fabricate(:small_action, topic: topic, user: user)
|
||||
|
||||
summary = UserSummary.new(user, Guardian.new)
|
||||
|
||||
expect(summary.topics.length).to eq(1)
|
||||
expect(summary.replies.length).to eq(1)
|
||||
expect(summary.top_categories.length).to eq(1)
|
||||
expect(summary.top_categories.first[:topic_count]).to eq(1)
|
||||
expect(summary.top_categories.first[:post_count]).to eq(1)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user