Also allow system_user to send pm's even if enable_private_messages is disabled
This commit is contained in:
parent
1a7ef2ae64
commit
7993c27ce5
|
@ -210,7 +210,9 @@ class Guardian
|
|||
# Have to be a basic level at least
|
||||
@user.has_trust_level?(:basic) &&
|
||||
# PMs are enabled
|
||||
(SiteSetting.enable_private_messages || @user.username == SiteSetting.site_contact_username)
|
||||
(SiteSetting.enable_private_messages ||
|
||||
@user.username == SiteSetting.site_contact_username ||
|
||||
@user == Discourse.system_user)
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
@ -136,9 +136,10 @@ describe Guardian do
|
|||
Guardian.new(user).can_send_private_message?(another_user).should be_false
|
||||
end
|
||||
|
||||
it "returns true for the contact user" do
|
||||
it "returns true for the contact user and system user" do
|
||||
SiteSetting.stubs(:site_contact_username).returns(user.username)
|
||||
Guardian.new(user).can_send_private_message?(another_user).should be_true
|
||||
Guardian.new(Discourse.system_user).can_send_private_message?(another_user).should be_true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue