FIX: Allow silenced users to like / bookmark, just not flag.
This commit is contained in:
parent
37d4f27c44
commit
a83f662492
|
@ -37,8 +37,8 @@ module PostGuardian
|
|||
|
||||
result = if authenticated? && post && !@user.anonymous?
|
||||
|
||||
# Silenced users can't act on posts
|
||||
return false if @user.silenced?
|
||||
# Silenced users can't flag
|
||||
return false if is_flag && @user.silenced?
|
||||
|
||||
# post made by staff, but we don't allow staff flags
|
||||
return false if is_flag &&
|
||||
|
|
|
@ -104,9 +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
|
||||
it "works as expected for silenced users" do
|
||||
UserSilencer.silence(user, admin)
|
||||
expect(Guardian.new(user).post_can_act?(post, :spam)).to be_falsey
|
||||
expect(Guardian.new(user).post_can_act?(post, :like)).to be_truthy
|
||||
expect(Guardian.new(user).post_can_act?(post, :bookmark)).to be_truthy
|
||||
end
|
||||
|
||||
it "allows flagging archived posts" do
|
||||
|
|
Loading…
Reference in New Issue