FIX: users should be allowed to add @ to the to field of a PM

This commit is contained in:
Sam 2014-12-30 13:26:39 +11:00
parent 8cfd14120c
commit d0fe1725c8
3 changed files with 4 additions and 3 deletions

View File

@ -25,6 +25,7 @@ export default TextField.extend({
allowAny: this.get('allowAny'),
dataSource: function(term) {
term = term.replace(/[^a-zA-Z0-9_]/, '');
return userSearch({
term: term,
topicId: self.get('topicId'),

View File

@ -231,8 +231,8 @@ en:
base:
warning_requires_pm: "You can only attach warnings to private messages."
too_many_users: "You can only send warnings to one user at a time."
archetype:
cant_send_pm: "Sorry, you cannot send a private message to that user."
no_user_selected: "You must select a valid user."
user:
attributes:
password:

View File

@ -114,7 +114,7 @@ class TopicCreator
@topic.subtype = TopicSubtype.user_to_user unless @topic.subtype
unless @opts[:target_usernames].present? || @opts[:target_group_names].present?
@topic.errors.add(:archetype, :cant_send_pm)
@topic.errors.add(:base, :no_user_selected)
@errors = @topic.errors
raise ActiveRecord::Rollback.new
end
@ -150,7 +150,7 @@ class TopicCreator
def check_can_send_permission!(topic,item)
unless @guardian.can_send_private_message?(item)
topic.errors.add(:archetype, :cant_send_pm)
topic.errors.add(:base, :cant_send_pm)
@errors = topic.errors
raise ActiveRecord::Rollback.new
end