From aa3a33f4097cb7c126074dc96722538000b840c3 Mon Sep 17 00:00:00 2001
From: noellabo <noel.yoshiba@gmail.com>
Date: Sun, 7 Jul 2019 22:45:29 +0900
Subject: [PATCH] Add a hashtag post to a list feed

---
 app/services/fan_out_on_write_service.rb | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/app/services/fan_out_on_write_service.rb b/app/services/fan_out_on_write_service.rb
index 95336ef450..4b9dc01feb 100644
--- a/app/services/fan_out_on_write_service.rb
+++ b/app/services/fan_out_on_write_service.rb
@@ -74,6 +74,11 @@ class FanOutOnWriteService < BaseService
     status.tags.pluck(:name).each do |hashtag|
       Redis.current.publish("timeline:hashtag:#{hashtag.mb_chars.downcase}", @payload)
       Redis.current.publish("timeline:hashtag:#{hashtag.mb_chars.downcase}:local", @payload) if status.local?
+      List.where('title ILIKE ?', "%##{hashtag}%").select(:id).reorder(nil).find_in_batches do |lists|
+        FeedInsertWorker.push_bulk(lists) do |list|
+          [status.id, list.id, :list]
+        end
+      end
     end
   end
 
-- 
GitLab