mirror of
https://github.com/discourse/discourse.git
synced 2025-06-04 20:34:50 +08:00
New mode for Wordpress: Filter ONLY posts liked by moderators
This commit is contained in:
@ -23,6 +23,9 @@ describe TopicView do
|
||||
let!(:p2) { Fabricate(:post, topic: topic, user: coding_horror, percent_rank: 0.5 )}
|
||||
let!(:p3) { Fabricate(:post, topic: topic, user: first_poster, percent_rank: 0 )}
|
||||
|
||||
let(:moderator) { Fabricate(:moderator) }
|
||||
let(:admin) { Fabricate(:admin)
|
||||
}
|
||||
it "it can find the best responses" do
|
||||
|
||||
best2 = TopicView.new(topic.id, coding_horror, best: 2)
|
||||
@ -61,6 +64,21 @@ describe TopicView do
|
||||
# 0 means ignore
|
||||
best = TopicView.new(topic.id, nil, best: 99, bypass_trust_level_score: 0, min_trust_level: coding_horror.trust_level + 1)
|
||||
best.posts.count.should == 0
|
||||
|
||||
# If we restrict to posts a moderator liked, return none
|
||||
best = TopicView.new(topic.id, nil, best: 99, only_moderator_liked: true)
|
||||
best.posts.count.should == 0
|
||||
|
||||
# It doesn't count likes from admins
|
||||
PostAction.act(admin, p3, PostActionType.types[:like])
|
||||
best = TopicView.new(topic.id, nil, best: 99, only_moderator_liked: true)
|
||||
best.posts.count.should == 0
|
||||
|
||||
# It should find the post liked by the moderator
|
||||
PostAction.act(moderator, p2, PostActionType.types[:like])
|
||||
best = TopicView.new(topic.id, nil, best: 99, only_moderator_liked: true)
|
||||
best.posts.count.should == 1
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user