FIX: Silenced users shouldn't be able to act on posts

This commit is contained in:
Robin Ward
2018-08-14 11:43:39 -04:00
parent 2927294cc6
commit 87fa26b6c8
2 changed files with 9 additions and 0 deletions

View File

@ -104,6 +104,11 @@ describe Guardian do
expect(Guardian.new(user).post_can_act?(post, :like)).to be_falsey
end
it "returns false when the user is silenced" do
UserSilencer.silence(user, admin)
expect(Guardian.new(user).post_can_act?(post, :spam)).to be_falsey
end
it "allows flagging archived posts" do
post.topic.archived = true
expect(Guardian.new(user).post_can_act?(post, :spam)).to be_truthy