diff options
author | beatrix <beatrix.bitrot@gmail.com> | 2017-05-20 07:38:13 -0400 |
---|---|---|
committer | Eugen Rochko <eugen@zeonfederated.com> | 2017-05-20 13:38:13 +0200 |
commit | 724fc3cbdfa03b094eee331e18e58869a5526bfd (patch) | |
tree | 15c860c26198a4e474f1fe4f09a6c5436c3240ca /app/models | |
parent | de475cf8d32744330f8029f13c539237a6567029 (diff) |
guard against empty domain block list in status scope (#3161)
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/status.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/app/models/status.rb b/app/models/status.rb index 88bfd1748..a4e581a06 100644 --- a/app/models/status.rb +++ b/app/models/status.rb @@ -68,7 +68,7 @@ class Status < ApplicationRecord scope :excluding_silenced_accounts, -> { left_outer_joins(:account).where(accounts: { silenced: false }) } scope :including_silenced_accounts, -> { left_outer_joins(:account).where(accounts: { silenced: true }) } scope :not_excluded_by_account, ->(account) { where.not(account_id: account.excluded_from_timeline_account_ids) } - scope :not_domain_blocked_by_account, ->(account) { left_outer_joins(:account).where('accounts.domain IS NULL OR accounts.domain NOT IN (?)', account.excluded_from_timeline_domains) } + scope :not_domain_blocked_by_account, ->(account) { account.excluded_from_timeline_domains.blank? ? left_outer_joins(:account) : left_outer_joins(:account).where('accounts.domain IS NULL OR accounts.domain NOT IN (?)', account.excluded_from_timeline_domains) } cache_associated :account, :application, :media_attachments, :tags, :stream_entry, mentions: :account, reblog: [:account, :application, :stream_entry, :tags, :media_attachments, mentions: :account], thread: :account |