FIX: We loosened username restrictions some time ago
Additionally, remove `Discourse.User` constant
This commit is contained in:
parent
458d9cd17a
commit
b6bb8df622
|
@ -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,
|
||||||
|
|
Loading…
Reference in New Issue