FIX: We loosened username restrictions some time ago

Additionally, remove `Discourse.User` constant
This commit is contained in:
Robin Ward 2018-07-31 13:53:05 -04:00
parent 458d9cd17a
commit b6bb8df622
1 changed files with 6 additions and 6 deletions

View File

@ -46,6 +46,11 @@ export default TextField.extend({
return usernames; return usernames;
} }
const termRegexp = (currentUser && currentUser.can_send_private_email_messages) ?
/[^\w.-@]/g :
/[^\w.-]/g;
this.$() this.$()
.val(this.get("usernames")) .val(this.get("usernames"))
.autocomplete({ .autocomplete({
@ -56,14 +61,9 @@ export default TextField.extend({
updateData: opts && opts.updateData ? opts.updateData : false, updateData: opts && opts.updateData ? opts.updateData : false,
dataSource(term) { dataSource(term) {
const termRegex = Discourse.User.currentProp(
"can_send_private_email_messages"
)
? /[^a-zA-Z0-9_\-\.@\+]/
: /[^a-zA-Z0-9_\-\.]/;
var results = userSearch({ var results = userSearch({
term: term.replace(termRegex, ""), term: term.replace(termRegexp, ""),
topicId: self.get("topicId"), topicId: self.get("topicId"),
exclude: excludedUsernames(), exclude: excludedUsernames(),
includeGroups, includeGroups,