Merge remote-tracking branch 'origin/master' into gs-master
This commit is contained in:
@ -68,7 +68,10 @@ class Notification < ApplicationRecord
|
||||
class << self
|
||||
def reload_stale_associations!(cached_items)
|
||||
account_ids = cached_items.map(&:from_account_id).uniq
|
||||
accounts = Account.where(id: account_ids).map { |a| [a.id, a] }.to_h
|
||||
|
||||
return if account_ids.empty?
|
||||
|
||||
accounts = Account.where(id: account_ids).map { |a| [a.id, a] }.to_h
|
||||
|
||||
cached_items.each do |item|
|
||||
item.from_account = accounts[item.from_account_id]
|
||||
|
@ -134,7 +134,7 @@ class Status < ApplicationRecord
|
||||
CustomEmoji.from_text([spoiler_text, text].join(' '), account.domain)
|
||||
end
|
||||
|
||||
after_create :store_uri, if: :local?
|
||||
after_create_commit :store_uri, if: :local?
|
||||
|
||||
around_create Mastodon::Snowflake::Callbacks
|
||||
|
||||
@ -194,7 +194,11 @@ class Status < ApplicationRecord
|
||||
account_ids << item.reblog.account_id if item.reblog?
|
||||
end
|
||||
|
||||
accounts = Account.where(id: account_ids.uniq).map { |a| [a.id, a] }.to_h
|
||||
account_ids.uniq!
|
||||
|
||||
return if account_ids.empty?
|
||||
|
||||
accounts = Account.where(id: account_ids).map { |a| [a.id, a] }.to_h
|
||||
|
||||
cached_items.each do |item|
|
||||
item.account = accounts[item.account_id]
|
||||
@ -216,9 +220,7 @@ class Status < ApplicationRecord
|
||||
# non-followers can see everything that isn't private/direct, but can see stuff they are mentioned in.
|
||||
visibility.push(:private) if account.following?(target_account)
|
||||
|
||||
joins("LEFT OUTER JOIN mentions ON statuses.id = mentions.status_id AND mentions.account_id = #{account.id}")
|
||||
.where(arel_table[:visibility].in(visibility).or(Mention.arel_table[:id].not_eq(nil)))
|
||||
.order(visibility: :desc)
|
||||
where(visibility: visibility).or(where(id: account.mentions.select(:status_id)))
|
||||
end
|
||||
end
|
||||
|
||||
|
Reference in New Issue
Block a user