diff --git a/app/services/batched_remove_status_service.rb b/app/services/batched_remove_status_service.rb index 51dfe50ab11e9a..3ca241d2417c14 100644 --- a/app/services/batched_remove_status_service.rb +++ b/app/services/batched_remove_status_service.rb @@ -76,7 +76,7 @@ def unpush_from_list_timelines(account, statuses) def unpush_from_group_timelines(status) return unless status.account.group? - payload = Oj.dump(event: :delete, payload: status.reblog.id.to_s) + payload = Oj.dump(event: :delete, payload: status.reblog? ? status.reblog.id.to_s : status.id.to_s) redis.publish("timeline:group:#{status.account.id}", payload) diff --git a/app/services/remove_status_service.rb b/app/services/remove_status_service.rb index 97b8e9c16106d5..908595a84e447f 100644 --- a/app/services/remove_status_service.rb +++ b/app/services/remove_status_service.rb @@ -11,11 +11,10 @@ class RemoveStatusService < BaseService # @option [Boolean] :immediate # @option [Boolean] :original_removed def call(status, **options) - @payload = Oj.dump(event: :delete, payload: status.id.to_s) - @reblog_payload = Oj.dump(event: :delete, payload: status.reblog.id.to_s) if status.reblog - @status = status - @account = status.account - @options = options + @payload = Oj.dump(event: :delete, payload: status.id.to_s) + @status = status + @account = status.account + @options = options @status.discard @@ -123,17 +122,19 @@ def remove_from_hashtags end def remove_from_group - redis.publish("timeline:group:#{@status.account.id}", @reblog_payload) + payload = @status.reblog? ? Oj.dump(event: :delete, payload: @status.reblog.id.to_s) : @payload + + redis.publish("timeline:group:#{@status.account.id}", payload) @status.tags.map(&:name).each do |hashtag| - redis.publish("timeline:group:#{@status.account.id}:#{hashtag.mb_chars.downcase}", @reblog_payload) + redis.publish("timeline:group:#{@status.account.id}:#{hashtag.mb_chars.downcase}", payload) end if @status.media_attachments.any? - redis.publish("timeline:group:media:#{@status.account.id}", @reblog_payload) + redis.publish("timeline:group:media:#{@status.account.id}", payload) @status.tags.map(&:name).each do |hashtag| - redis.publish("timeline:group:media:#{@status.account.id}:#{hashtag.mb_chars.downcase}", @reblog_payload) + redis.publish("timeline:group:media:#{@status.account.id}:#{hashtag.mb_chars.downcase}", payload) end end end