about summary refs log tree commit diff
path: root/app/services/remove_status_service.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/services/remove_status_service.rb')
-rw-r--r--app/services/remove_status_service.rb23
1 files changed, 12 insertions, 11 deletions
diff --git a/app/services/remove_status_service.rb b/app/services/remove_status_service.rb
index 4bee86c8a..99c8e6cbb 100644
--- a/app/services/remove_status_service.rb
+++ b/app/services/remove_status_service.rb
@@ -2,6 +2,7 @@
 
 class RemoveStatusService < BaseService
   include StreamEntryRenderer
+  include Redisable
 
   def call(status, **options)
     @payload      = Oj.dump(event: :delete, payload: status.id.to_s)
@@ -56,7 +57,7 @@ class RemoveStatusService < BaseService
 
   def remove_from_affected
     @mentions.map(&:account).select(&:local?).each do |account|
-      Redis.current.publish("timeline:#{account.id}", @payload)
+      redis.publish("timeline:#{account.id}", @payload)
     end
   end
 
@@ -131,26 +132,30 @@ class RemoveStatusService < BaseService
   end
 
   def remove_from_hashtags
+    @account.featured_tags.where(tag_id: @status.tags.pluck(:id)).each do |featured_tag|
+      featured_tag.decrement(@status.id)
+    end
+
     return unless @status.public_visibility?
 
     @tags.each do |hashtag|
-      Redis.current.publish("timeline:hashtag:#{hashtag}", @payload)
-      Redis.current.publish("timeline:hashtag:#{hashtag}:local", @payload) if @status.local?
+      redis.publish("timeline:hashtag:#{hashtag}", @payload)
+      redis.publish("timeline:hashtag:#{hashtag}:local", @payload) if @status.local?
     end
   end
 
   def remove_from_public
     return unless @status.public_visibility?
 
-    Redis.current.publish('timeline:public', @payload)
-    Redis.current.publish('timeline:public:local', @payload) if @status.local?
+    redis.publish('timeline:public', @payload)
+    redis.publish('timeline:public:local', @payload) if @status.local?
   end
 
   def remove_from_media
     return unless @status.public_visibility?
 
-    Redis.current.publish('timeline:public:media', @payload)
-    Redis.current.publish('timeline:public:local:media', @payload) if @status.local?
+    redis.publish('timeline:public:media', @payload)
+    redis.publish('timeline:public:local:media', @payload) if @status.local?
   end
 
   def remove_from_direct
@@ -159,8 +164,4 @@ class RemoveStatusService < BaseService
     end
     Redis.current.publish("timeline:direct:#{@account.id}", @payload) if @account.local?
   end
-
-  def redis
-    Redis.current
-  end
 end