Optimize some regex matching (#15528)
* Use Regex#match? * Replace =~ too * Avoid to call match? from Nil * Keep value of Regexp.last_match
This commit is contained in:
@ -175,7 +175,7 @@ class AccountSearchService < BaseService
|
||||
end
|
||||
|
||||
def username_complete?
|
||||
query.include?('@') && "@#{query}" =~ /\A#{Account::MENTION_RE}\Z/
|
||||
query.include?('@') && "@#{query}".match?(/\A#{Account::MENTION_RE}\Z/)
|
||||
end
|
||||
|
||||
def likely_acct?
|
||||
|
Reference in New Issue
Block a user