FIX: don't offer the "Something Else" flag reason to TL0 users since they don't have permission to send private messages
This commit is contained in:
parent
ad9553ff86
commit
fb5b9b6d06
|
@ -35,8 +35,9 @@ module PostGuardian
|
|||
# don't like your own stuff
|
||||
not(action_key == :like && is_my_own?(post)) &&
|
||||
|
||||
# new users can't notify_user because they are not allowed to send private messages
|
||||
not(action_key == :notify_user && !@user.has_trust_level?(SiteSetting.min_trust_to_send_messages)) &&
|
||||
# new users can't notify_user or notify_moderators because they are not allowed to send private messages
|
||||
not((action_key == :notify_user || action_key == :notify_moderators) &&
|
||||
!@user.has_trust_level?(SiteSetting.min_trust_to_send_messages)) &&
|
||||
|
||||
# no voting more than once on single vote topics
|
||||
not(action_key == :vote && opts[:voted_in_topic] && post.topic.has_meta_data_boolean?(:single_vote))
|
||||
|
|
|
@ -75,12 +75,12 @@ describe Guardian do
|
|||
expect(Guardian.new(user).post_can_act?(post, :notify_moderators)).to be_falsey
|
||||
end
|
||||
|
||||
it "returns false for notify_user if private messages are enabled but threshold not met" do
|
||||
it "returns false for notify_user and notify_moderators if private messages are enabled but threshold not met" do
|
||||
SiteSetting.enable_private_messages = true
|
||||
SiteSetting.min_trust_to_send_messages = 2
|
||||
user.trust_level = TrustLevel[1]
|
||||
expect(Guardian.new(user).post_can_act?(post, :notify_user)).to be_falsey
|
||||
expect(Guardian.new(user).post_can_act?(post, :notify_moderators)).to be_truthy
|
||||
expect(Guardian.new(user).post_can_act?(post, :notify_moderators)).to be_falsey
|
||||
end
|
||||
|
||||
describe "trust levels" do
|
||||
|
|
Loading…
Reference in New Issue