diff options
author | multiple creatures <dev@multiple-creature.party> | 2019-11-18 01:44:33 -0600 |
---|---|---|
committer | multiple creatures <dev@multiple-creature.party> | 2019-11-18 02:19:09 -0600 |
commit | 0d90c0f61a8cc59d1719f690252890f16952c13e (patch) | |
tree | 83ab8a77647d1a504c551260301d2b2c9d56dd65 /app/models | |
parent | 54afd828c2defddfc57faca2f6ea9052dad5bfa4 (diff) |
Only apply a user's string filters if they actually have any set (otherwise all posts will be filtered).
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/status.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/app/models/status.rb b/app/models/status.rb index adea5b9c3..af0c38624 100644 --- a/app/models/status.rb +++ b/app/models/status.rb @@ -119,7 +119,7 @@ class Status < ApplicationRecord 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 :not_string_filtered_by_account, ->(account) { where("statuses.normalized_text !~ ANY(ARRAY(#{account.custom_filters.select('unaccent(lower(phrase))').to_sql}))") } + scope :not_string_filtered_by_account, ->(account) { where("statuses.normalized_text !~ ANY(ARRAY(SELECT unaccent(lower(phrase)) FROM custom_filters WHERE account_id = ?))", account.id) } scope :not_missing_media_desc, -> { left_outer_joins(:media_attachments).where('media_attachments.id IS NULL OR media_attachments.description IS NOT NULL') } scope :tagged_with_all, ->(tags) { @@ -553,7 +553,7 @@ class Status < ApplicationRecord query = query.in_chosen_languages(account) if account.chosen_languages.present? query = query.reply_not_excluded_by_account(account) unless tag_timeline query = query.mention_not_excluded_by_account(account) - query = query.not_string_filtered_by_account(account) + query = query.not_string_filtered_by_account(account) if account.custom_filters.present? query = query.not_missing_media_desc if account.filter_undescribed? query.merge(account_silencing_filter(account)) end |