Merge branch 'master' into glitch-soc/merge-upstream

This commit is contained in:
Thibaut Girka
2020-02-29 12:20:54 +01:00
4 changed files with 35 additions and 11 deletions

View File

@@ -480,7 +480,16 @@ class Account < ApplicationRecord
def from_text(text)
return [] if text.blank?
text.scan(MENTION_RE).map { |match| match.first.split('@', 2) }.uniq.map { |(username, domain)| EntityCache.instance.mention(username, domain) }
text.scan(MENTION_RE).map { |match| match.first.split('@', 2) }.uniq.map do |(username, domain)|
domain = begin
if TagManager.instance.local_domain?(domain)
nil
else
TagManager.instance.normalize_domain(domain)
end
end
EntityCache.instance.mention(username, domain)
end.compact
end
private