mirror of
https://github.com/discourse/discourse.git
synced 2025-04-11 15:50:50 +08:00
FIX: users should be allowed to add @ to the to field of a PM
This commit is contained in:
parent
8cfd14120c
commit
d0fe1725c8
@ -25,6 +25,7 @@ export default TextField.extend({
|
|||||||
allowAny: this.get('allowAny'),
|
allowAny: this.get('allowAny'),
|
||||||
|
|
||||||
dataSource: function(term) {
|
dataSource: function(term) {
|
||||||
|
term = term.replace(/[^a-zA-Z0-9_]/, '');
|
||||||
return userSearch({
|
return userSearch({
|
||||||
term: term,
|
term: term,
|
||||||
topicId: self.get('topicId'),
|
topicId: self.get('topicId'),
|
||||||
|
@ -231,8 +231,8 @@ en:
|
|||||||
base:
|
base:
|
||||||
warning_requires_pm: "You can only attach warnings to private messages."
|
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."
|
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."
|
cant_send_pm: "Sorry, you cannot send a private message to that user."
|
||||||
|
no_user_selected: "You must select a valid user."
|
||||||
user:
|
user:
|
||||||
attributes:
|
attributes:
|
||||||
password:
|
password:
|
||||||
|
@ -114,7 +114,7 @@ class TopicCreator
|
|||||||
@topic.subtype = TopicSubtype.user_to_user unless @topic.subtype
|
@topic.subtype = TopicSubtype.user_to_user unless @topic.subtype
|
||||||
|
|
||||||
unless @opts[:target_usernames].present? || @opts[:target_group_names].present?
|
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
|
@errors = @topic.errors
|
||||||
raise ActiveRecord::Rollback.new
|
raise ActiveRecord::Rollback.new
|
||||||
end
|
end
|
||||||
@ -150,7 +150,7 @@ class TopicCreator
|
|||||||
|
|
||||||
def check_can_send_permission!(topic,item)
|
def check_can_send_permission!(topic,item)
|
||||||
unless @guardian.can_send_private_message?(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
|
@errors = topic.errors
|
||||||
raise ActiveRecord::Rollback.new
|
raise ActiveRecord::Rollback.new
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user