New mode for Wordpress: Filter ONLY posts liked by moderators

This commit is contained in:
Robin Ward
2013-07-05 16:07:24 -04:00
parent 58d082d01e
commit 6cd6484b5e
5 changed files with 29 additions and 6 deletions

View File

@ -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