Sanitize remote html in atom feeds, API (not just UI), use cached mention
relations on Status#mentions
This commit is contained in:
parent
7cd3de3494
commit
c8999a116e
6 changed files with 18 additions and 31 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue