about summary refs log tree commit diff
path: root/app
diff options
context:
space:
mode:
authorThibG <thib@sitedethib.com>2020-02-28 13:49:45 +0100
committerGitHub <noreply@github.com>2020-02-28 13:49:45 +0100
commit7b63c5469ef0106aebe4151640832378e6d31067 (patch)
tree695a7fb0c2910523632e43ddaeda1654196aca76 /app
parentaa8568b7f2f9043056fa7a2bb9b59ef31d63554c (diff)
Fix announcements with fully-qualified mention to local user crashing WebUI (#13164)
Diffstat (limited to 'app')
-rw-r--r--app/models/account.rb11
1 files changed, 10 insertions, 1 deletions
diff --git a/app/models/account.rb b/app/models/account.rb
index 0eb719d65..778429b0d 100644
--- a/app/models/account.rb
+++ b/app/models/account.rb
@@ -478,7 +478,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