about summary refs log tree commit diff
path: root/app/workers/feed_insert_worker.rb
diff options
context:
space:
mode:
authorThibaut Girka <thib@sitedethib.com>2019-06-25 22:56:32 +0200
committerThibG <thib@sitedethib.com>2019-06-27 16:44:12 +0200
commitca17bae904783dfb1f4899a533d28a79da0c6fe9 (patch)
treec38565923e7b92c2125452daf35fecf76588f81d /app/workers/feed_insert_worker.rb
parent2f95adc06fbfae22e8f9b4df212938108f5e295c (diff)
Use a redis-cached feed for the DM timeline
Diffstat (limited to 'app/workers/feed_insert_worker.rb')
-rw-r--r--app/workers/feed_insert_worker.rb11
1 files changed, 10 insertions, 1 deletions
diff --git a/app/workers/feed_insert_worker.rb b/app/workers/feed_insert_worker.rb
index 1ae3c877b..546f5c0c2 100644
--- a/app/workers/feed_insert_worker.rb
+++ b/app/workers/feed_insert_worker.rb
@@ -13,6 +13,8 @@ class FeedInsertWorker
     when :list
       @list     = List.find(id)
       @follower = @list.account
+    when :direct
+      @account  = Account.find(id)
     end
 
     check_and_insert
@@ -29,7 +31,12 @@ class FeedInsertWorker
   def feed_filtered?
     # Note: Lists are a variation of home, so the filtering rules
     # of home apply to both
-    FeedManager.instance.filter?(:home, @status, @follower.id)
+    case @type
+    when :home, :list
+      FeedManager.instance.filter?(:home, @status, @follower.id)
+    when :direct
+      FeedManager.instance.filter?(:direct, @status, @account.id)
+    end
   end
 
   def perform_push
@@ -38,6 +45,8 @@ class FeedInsertWorker
       FeedManager.instance.push_to_home(@follower, @status)
     when :list
       FeedManager.instance.push_to_list(@list, @status)
+    when :direct
+      FeedManager.instance.push_to_direct(@account, @status)
     end
   end
 end