Browse Source

Fix announcements with fully-qualified mention to local user crashing WebUI (#13164)

master
ThibG 4 years ago
committed by GitHub
parent
commit
7b63c5469e
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 1 deletions
  1. +10
    -1
      app/models/account.rb

+ 10
- 1
app/models/account.rb View File

@ -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

Loading…
Cancel
Save