about summary refs log tree commit diff
path: root/app/lib/feed_manager.rb
diff options
context:
space:
mode:
authorFire Demon <firedemon@creature.cafe>2020-07-21 01:44:16 -0500
committerFire Demon <firedemon@creature.cafe>2020-08-30 05:44:01 -0500
commit263ead73616dba43a0337c2a3edaf96a6382d533 (patch)
treeca47a9366dbbdf95018c55bde32b59d6b05c8299 /app/lib/feed_manager.rb
parent21de9efc2d89ce8dbb9edb997f8a3b99f831d05a (diff)
[Feature] Add post and thread (un)hiding to backend
Diffstat (limited to 'app/lib/feed_manager.rb')
-rw-r--r--app/lib/feed_manager.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/app/lib/feed_manager.rb b/app/lib/feed_manager.rb
index 2dc60092c..80f1f8926 100644
--- a/app/lib/feed_manager.rb
+++ b/app/lib/feed_manager.rb
@@ -82,6 +82,25 @@ class FeedManager
     redis.publish("timeline:direct:#{account.id}", Oj.dump(event: :delete, payload: status.id.to_s))
   end
 
+  def unpush_status(account, status)
+    return if account.blank? || status.blank?
+
+    unpush_from_home(account, status)
+    unpush_from_direct(account, status) if status.direct_visibility?
+
+    account.lists_for_local_distribution.select(:id, :account_id).each do |list|
+      unpush_from_list(list, status)
+    end
+  end
+
+  def unpush_conversation(account, conversation)
+    return if account.blank? || conversation.blank?
+
+    conversation.statuses.reorder(nil).find_each do |status|
+      unpush_status(account, status)
+    end
+  end
+
   def trim(type, account_id)
     timeline_key = key(type, account_id)
     reblog_key   = key(type, account_id, 'reblogs')