about summary refs log tree commit diff
path: root/app/models
diff options
context:
space:
mode:
Diffstat (limited to 'app/models')
-rw-r--r--app/models/custom_filter.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/app/models/custom_filter.rb b/app/models/custom_filter.rb
index a90b99c48..67d1a0bea 100644
--- a/app/models/custom_filter.rb
+++ b/app/models/custom_filter.rb
@@ -18,4 +18,19 @@ class CustomFilter < ApplicationRecord
   belongs_to :account
 
   validates :phrase, presence: true
+
+  after_save :update_feeds
+  after_save :remove_cache
+
+  private
+
+  def update_feeds
+    FilterFeedsWorker.perform_async(account_id)
+  end
+
+  private
+
+  def remove_cache
+    redis.del("filtered_statuses:#{account_id}")
+  end
 end