0
0
Fork 0

Sanitize remote html in atom feeds, API (not just UI), use cached mention

relations on Status#mentions
This commit is contained in:
Eugen Rochko 2016-03-24 12:40:55 +01:00
parent 7cd3de3494
commit c8999a116e
6 changed files with 18 additions and 31 deletions

View file

@ -60,22 +60,15 @@ class Status < ActiveRecord::Base
end
def mentions
m = []
m << thread.account if reply?
m << reblog.account if reblog?
unless reblog?
self.text.scan(Account::MENTION_RE).each do |match|
uri = match.first
username, domain = uri.split('@')
account = Account.find_by(username: username, domain: domain)
m << account unless account.nil?
end
if @mentions.nil?
@mentions = []
@mentions << thread.account if reply?
@mentions << reblog.account if reblog?
self.mentioned_accounts.each { |mention| @mentions << mention.account } unless reblog?
@mentions = @mentions.uniq
end
m.uniq
@mentions
end
def ancestors