about summary refs log tree commit diff
path: root/app/models/status.rb
diff options
context:
space:
mode:
authormultiple creatures <dev@multiple-creature.party>2020-01-10 14:19:04 -0600
committermultiple creatures <dev@multiple-creature.party>2020-01-10 14:19:04 -0600
commit13b4d7953adfa8455f800a56124c7d6ecafa41ca (patch)
tree76fa5d86a2e646c09b08637625cc31aaa2f694b0 /app/models/status.rb
parente13202c114eeb7584e776a073a41d9e57ae31e02 (diff)
add ability to toggle individual filters without deleting them
Diffstat (limited to 'app/models/status.rb')
-rw-r--r--app/models/status.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/app/models/status.rb b/app/models/status.rb
index 515553708..5a1d38932 100644
--- a/app/models/status.rb
+++ b/app/models/status.rb
@@ -119,8 +119,8 @@ class Status < ApplicationRecord
 
   scope :search, ->(needle) { where("tsv @@ websearch_to_tsquery('fedi', ?)", needle) }
   scope :search_not, ->(needle) { where.not("tsv @@ websearch_to_tsquery('fedi', ?)", needle) }
-  scope :search_filtered_by_account, ->(account_id) { where('tsv @@ (SELECT tsquery_union(websearch_to_tsquery(phrase)) FROM custom_filters WHERE account_id = ?)', account_id) }
-  scope :search_not_filtered_by_account, ->(account_id) { where.not('tsv @@ (SELECT tsquery_union(websearch_to_tsquery(phrase)) FROM custom_filters WHERE account_id = ?)', account_id) }
+  scope :search_filtered_by_account, ->(account_id) { where('tsv @@ (SELECT tsquery_union(websearch_to_tsquery(phrase)) FROM custom_filters WHERE account_id = ? AND is_enabled)', account_id) }
+  scope :search_not_filtered_by_account, ->(account_id) { where.not('tsv @@ (SELECT tsquery_union(websearch_to_tsquery(phrase)) FROM custom_filters WHERE account_id = ? AND is_enabled)', account_id) }
 
   scope :not_missing_media_desc, -> { left_outer_joins(:media_attachments).select('statuses.*').where('media_attachments.id IS NULL OR media_attachments.description IS NOT NULL') }
 
@@ -578,7 +578,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)
-      unless account.custom_filters.empty?
+      unless account.custom_filters.enabled.empty?
         if account.user.invert_filters
           query = query.search_filtered_by_account(account.id)
         else