mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 03:16:41 +08:00
FEATURE: allow people to send messages to themselves (for notes etc)
This commit is contained in:
parent
92daf44daf
commit
d61df21d69
|
@ -1,6 +1,5 @@
|
||||||
{{#if showSelector}}
|
{{#if showSelector}}
|
||||||
{{user-selector topicId=topicId
|
{{user-selector topicId=topicId
|
||||||
excludeCurrentUser='true'
|
|
||||||
onChangeCallback='triggerResize'
|
onChangeCallback='triggerResize'
|
||||||
id="private-message-users"
|
id="private-message-users"
|
||||||
includeMentionableGroups='true'
|
includeMentionableGroups='true'
|
||||||
|
|
|
@ -267,8 +267,6 @@ class Guardian
|
||||||
(target.is_a?(Group) || target.is_a?(User)) &&
|
(target.is_a?(Group) || target.is_a?(User)) &&
|
||||||
# User is authenticated
|
# User is authenticated
|
||||||
authenticated? &&
|
authenticated? &&
|
||||||
# Can't send message to yourself
|
|
||||||
is_not_me?(target) &&
|
|
||||||
# Have to be a basic level at least
|
# Have to be a basic level at least
|
||||||
@user.has_trust_level?(SiteSetting.min_trust_to_send_messages) &&
|
@user.has_trust_level?(SiteSetting.min_trust_to_send_messages) &&
|
||||||
# PMs are enabled
|
# PMs are enabled
|
||||||
|
|
|
@ -144,8 +144,9 @@ describe Guardian do
|
||||||
expect(Guardian.new(user).can_send_private_message?(nil)).to be_falsey
|
expect(Guardian.new(user).can_send_private_message?(nil)).to be_falsey
|
||||||
end
|
end
|
||||||
|
|
||||||
it "returns false when the target is the same as the user" do
|
it "returns true when the target is the same as the user" do
|
||||||
expect(Guardian.new(user).can_send_private_message?(user)).to be_falsey
|
# this is now allowed so yay
|
||||||
|
expect(Guardian.new(user).can_send_private_message?(user)).to be_truthy
|
||||||
end
|
end
|
||||||
|
|
||||||
it "returns false when you are untrusted" do
|
it "returns false when you are untrusted" do
|
||||||
|
|
Loading…
Reference in New Issue
Block a user