mirror of
https://github.com/mastodon/mastodon.git
synced 2024-11-20 03:25:17 +01:00
Merge commit from fork
This should not change the set of words matched by `USERNAME_RE` but does change the one matched by `MENTION_RE`. Indeed, the previous regexp allowed a domain part to start with `.` or `-`, which the new regexp does not allow.
This commit is contained in:
parent
e22eff8900
commit
0c872beed4
@ -68,8 +68,8 @@ class Account < ApplicationRecord
|
|||||||
DEFAULT_FIELDS_SIZE = 4
|
DEFAULT_FIELDS_SIZE = 4
|
||||||
INSTANCE_ACTOR_ID = -99
|
INSTANCE_ACTOR_ID = -99
|
||||||
|
|
||||||
USERNAME_RE = /[a-z0-9_]+([a-z0-9_.-]+[a-z0-9_]+)?/i
|
USERNAME_RE = /[a-z0-9_]+([.-]+[a-z0-9_]+)*/i
|
||||||
MENTION_RE = %r{(?<![=/[:word:]])@((#{USERNAME_RE})(?:@[[:word:].-]+[[:word:]]+)?)}
|
MENTION_RE = %r{(?<![=/[:word:]])@((#{USERNAME_RE})(?:@[[:word:]]+([.-]+[[:word:]]+)*)?)}
|
||||||
URL_PREFIX_RE = %r{\Ahttp(s?)://[^/]+}
|
URL_PREFIX_RE = %r{\Ahttp(s?)://[^/]+}
|
||||||
USERNAME_ONLY_RE = /\A#{USERNAME_RE}\z/i
|
USERNAME_ONLY_RE = /\A#{USERNAME_RE}\z/i
|
||||||
USERNAME_LENGTH_LIMIT = 30
|
USERNAME_LENGTH_LIMIT = 30
|
||||||
|
Loading…
Reference in New Issue
Block a user