mirror of
https://github.com/discourse/discourse.git
synced 2025-01-19 05:43:16 +08:00
FIX: Couldn't like staff when allow_flagging_staff
was set
This commit is contained in:
parent
a3e5a31674
commit
b4aa0b096e
|
@ -22,7 +22,9 @@ module PostGuardian
|
|||
result = if authenticated? && post && !@user.anonymous?
|
||||
|
||||
# post made by staff, but we don't allow staff flags
|
||||
return false if !SiteSetting.allow_flagging_staff? && post.user.staff?
|
||||
return false if is_flag &&
|
||||
(!SiteSetting.allow_flagging_staff?) &&
|
||||
post.user.staff?
|
||||
|
||||
return false if [:notify_user, :notify_moderators].include?(action_key) &&
|
||||
!SiteSetting.enable_personal_messages?
|
||||
|
|
|
@ -83,6 +83,12 @@ describe Guardian do
|
|||
expect(Guardian.new(user).post_can_act?(staff_post, :spam)).to eq(false)
|
||||
end
|
||||
|
||||
it "allows liking of staff when allow_flagging_staff is false" do
|
||||
SiteSetting.allow_flagging_staff = false
|
||||
staff_post = Fabricate(:post, user: Fabricate(:moderator))
|
||||
expect(Guardian.new(user).post_can_act?(staff_post, :like)).to eq(true)
|
||||
end
|
||||
|
||||
it "returns false when liking yourself" do
|
||||
expect(Guardian.new(post.user).post_can_act?(post, :like)).to be_falsey
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue
Block a user