mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 08:09:33 +08:00
FIX: username mentions weren't working when immediately followed by a dot
This commit is contained in:
parent
850838147a
commit
c5f9ae0de1
|
@ -4,7 +4,7 @@
|
|||
**/
|
||||
Discourse.Dialect.inlineRegexp({
|
||||
start: '#',
|
||||
matcher: /^#([\w-]{1,50})/,
|
||||
matcher: /^#([\w-]{1,50})/i,
|
||||
spaceOrTagBoundary: true,
|
||||
|
||||
emitter: function(matches) {
|
||||
|
|
|
@ -7,11 +7,11 @@ Discourse.Dialect.inlineRegexp({
|
|||
start: '@',
|
||||
// NOTE: since we can't use SiteSettings here (they loads later in process)
|
||||
// we are being less strict to account for more cases than allowed
|
||||
matcher: /^@([\w.-]+)/,
|
||||
matcher: /^@(\w[\w.-]{0,59})\b/i,
|
||||
wordBoundary: true,
|
||||
|
||||
emitter: function(matches) {
|
||||
var mention = matches[0],
|
||||
var mention = matches[0].trim(),
|
||||
name = matches[1],
|
||||
mentionLookup = this.dialect.options.mentionLookup;
|
||||
|
||||
|
|
|
@ -61,21 +61,21 @@ class UsernameValidator
|
|||
|
||||
def username_char_valid?
|
||||
return unless errors.empty?
|
||||
if username =~ /[^A-Za-z0-9_\.\-]/
|
||||
if username =~ /[^\w.-]/
|
||||
self.errors << I18n.t(:'user.username.characters')
|
||||
end
|
||||
end
|
||||
|
||||
def username_first_char_valid?
|
||||
return unless errors.empty?
|
||||
if username[0] =~ /[^A-Za-z0-9_]/
|
||||
if username[0] =~ /[^\w]/
|
||||
self.errors << I18n.t(:'user.username.must_begin_with_alphanumeric')
|
||||
end
|
||||
end
|
||||
|
||||
def username_last_char_valid?
|
||||
return unless errors.empty?
|
||||
if username[-1] =~ /[^A-Za-z0-9_]/
|
||||
if username[-1] =~ /[^\w]/
|
||||
self.errors << I18n.t(:'user.username.must_end_with_alphanumeric')
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue
Block a user