mirror of
https://github.com/mastodon/mastodon.git
synced 2025-07-15 08:48:15 +00:00
Use TwitterText regex for valid domains in mentions
TwitterText already has a regex to check for valid domains that allows a few domains the current Regex did not allow. Mainly it allows mentions of accounts on domains with emoji in their domain names to be processed correctly. Mentions like `@test@🌈🌈🌈.st` will now work correctly.
This commit is contained in:
parent
4de108e755
commit
1b909c98ab
|
@ -71,7 +71,7 @@ class Account < ApplicationRecord
|
|||
INSTANCE_ACTOR_ID = -99
|
||||
|
||||
USERNAME_RE = /[a-z0-9_]+([.-]+[a-z0-9_]+)*/i
|
||||
MENTION_RE = %r{(?<![=/[:word:]])@((#{USERNAME_RE})(?:@[[:word:]]+([.-]+[[:word:]]+)*)?)}
|
||||
MENTION_RE = %r{(?<![=/[:word:]])@((#{USERNAME_RE})(?:@#{Twitter::TwitterText::Regex[:valid_domain]})?)}
|
||||
URL_PREFIX_RE = %r{\Ahttp(s?)://[^/]+}
|
||||
USERNAME_ONLY_RE = /\A#{USERNAME_RE}\z/i
|
||||
USERNAME_LENGTH_LIMIT = 30
|
||||
|
|
Loading…
Reference in New Issue
Block a user