1
0
mirror of https://github.com/funamitech/mastodon synced 2024-11-24 23:26:42 +09:00

Fix account timelines bug

This commit is contained in:
Eugen Rochko 2016-12-23 01:13:16 +01:00
parent 26f969665d
commit 6e064cf715

View File

@ -31,6 +31,7 @@ class Status < ApplicationRecord
scope :remote, -> { where.not(uri: nil) } scope :remote, -> { where.not(uri: nil) }
scope :local, -> { where(uri: nil) } scope :local, -> { where(uri: nil) }
scope :permitted_for, ->(target_account, account) { account&.id == target_account.id || account&.following?(target_account) ? where('1=1') : where.not(visibility: :private) }
cache_associated :account, :media_attachments, :tags, :stream_entry, mentions: :account, reblog: [:account, :stream_entry, :tags, :media_attachments, mentions: :account], thread: :account cache_associated :account, :media_attachments, :tags, :stream_entry, mentions: :account, reblog: [:account, :stream_entry, :tags, :media_attachments, mentions: :account], thread: :account
@ -128,14 +129,6 @@ class Status < ApplicationRecord
select('reblog_of_id').where(reblog_of_id: status_ids).where(account_id: account_id).map { |s| [s.reblog_of_id, true] }.to_h select('reblog_of_id').where(reblog_of_id: status_ids).where(account_id: account_id).map { |s| [s.reblog_of_id, true] }.to_h
end end
def permitted_for(target_account, account)
if account&.id == target_account.id || account&.following?(target_account)
self
else
where.not(visibility: :private)
end
end
def reload_stale_associations!(cached_items) def reload_stale_associations!(cached_items)
account_ids = [] account_ids = []