FEATURE: allow people to send messages to themselves (for notes etc)

This commit is contained in:
Sam 2016-07-04 11:36:43 +10:00
parent 92daf44daf
commit d61df21d69
3 changed files with 3 additions and 5 deletions

View File

@ -1,6 +1,5 @@
{{#if showSelector}}
{{user-selector topicId=topicId
excludeCurrentUser='true'
onChangeCallback='triggerResize'
id="private-message-users"
includeMentionableGroups='true'

View File

@ -267,8 +267,6 @@ class Guardian
(target.is_a?(Group) || target.is_a?(User)) &&
# User is authenticated
authenticated? &&
# Can't send message to yourself
is_not_me?(target) &&
# Have to be a basic level at least
@user.has_trust_level?(SiteSetting.min_trust_to_send_messages) &&
# PMs are enabled

View File

@ -144,8 +144,9 @@ describe Guardian do
expect(Guardian.new(user).can_send_private_message?(nil)).to be_falsey
end
it "returns false when the target is the same as the user" do
expect(Guardian.new(user).can_send_private_message?(user)).to be_falsey
it "returns true when the target is the same as the user" do
# this is now allowed so yay
expect(Guardian.new(user).can_send_private_message?(user)).to be_truthy
end
it "returns false when you are untrusted" do