diff options
author | multiple creatures <dev@multiple-creature.party> | 2019-01-06 16:06:26 -0600 |
---|---|---|
committer | multiple creatures <dev@multiple-creature.party> | 2019-05-21 03:16:21 -0500 |
commit | 5c6a14ca68c3fba3ee778588c080c77a92d53e66 (patch) | |
tree | 1a7d46bd85c268731c65186b4281fa39606beff2 /app/models | |
parent | cf557f18497e98aea0dbf8a799186aa92dc34663 (diff) |
Prune replies to muted/blocked accounts
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/status.rb | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/app/models/status.rb b/app/models/status.rb index 7a3b4da36..21a0ac84f 100644 --- a/app/models/status.rb +++ b/app/models/status.rb @@ -92,6 +92,8 @@ class Status < ApplicationRecord scope :excluding_silenced_accounts, -> { left_outer_joins(:account).where(accounts: { silenced_at: nil }) } scope :including_silenced_accounts, -> { left_outer_joins(:account).where.not(accounts: { silenced_at: nil }) } scope :not_excluded_by_account, ->(account) { where.not(account_id: account.excluded_from_timeline_account_ids) } + scope :reply_not_excluded_by_account, ->(account) { where('statuses.in_reply_to_account_id IS NULL OR statuses.in_reply_to_account_id NOT IN (?)', account.excluded_from_timeline_account_ids) } + scope :mention_not_excluded_by_account, ->(account) { left_outer_joins(:mentions).where('mentions.account_id IS NULL OR mentions.account_id NOT IN (?)', account.excluded_from_timeline_account_ids) } 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) } scope :tagged_with_all, ->(tags) { Array(tags).map(&:id).map(&:to_i).reduce(self) do |result, id| @@ -433,6 +435,8 @@ class Status < ApplicationRecord query = query.not_excluded_by_account(account) query = query.not_domain_blocked_by_account(account) unless local_only query = query.in_chosen_languages(account) if account.chosen_languages.present? + query = query.reply_not_excluded_by_account(account) + query = query.mention_not_excluded_by_account(account) query.merge(account_silencing_filter(account)) end |