about summary refs log tree commit diff
path: root/app/services/batched_remove_status_service.rb
diff options
context:
space:
mode:
authorThibG <thib@sitedethib.com>2018-12-06 17:40:43 +0100
committerGitHub <noreply@github.com>2018-12-06 17:40:43 +0100
commite3682c9c1750e5e7e5d2f817e29f6760a18400ca (patch)
tree1fb5c57e634a16136e764178e2e1ca1d0e009a25 /app/services/batched_remove_status_service.rb
parent4167ed375bd9402e91a998fad8f173fa76b2eec3 (diff)
parent24822eca73ac2bc37870bd27cae8ee6b17785759 (diff)
Merge pull request #848 from ThibG/glitch-soc/merge-upstream
Merge upstream changes
Diffstat (limited to 'app/services/batched_remove_status_service.rb')
-rw-r--r--app/services/batched_remove_status_service.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/app/services/batched_remove_status_service.rb b/app/services/batched_remove_status_service.rb
index fc412c7d4..61c408926 100644
--- a/app/services/batched_remove_status_service.rb
+++ b/app/services/batched_remove_status_service.rb
@@ -9,7 +9,9 @@ class BatchedRemoveStatusService < BaseService
   # Remove statuses from home feeds
   # Push delete events to streaming API for home feeds and public feeds
   # @param [Status] statuses A preferably batched array of statuses
-  def call(statuses)
+  # @param [Hash] options
+  # @option [Boolean] :skip_side_effects
+  def call(statuses, **options)
     statuses = Status.where(id: statuses.map(&:id)).includes(:account, :stream_entry).flat_map { |status| [status] + status.reblogs.includes(:account, :stream_entry).to_a }
 
     @mentions = statuses.each_with_object({}) { |s, h| h[s.id] = s.active_mentions.includes(:account).to_a }
@@ -26,6 +28,8 @@ class BatchedRemoveStatusService < BaseService
       status.destroy
     end
 
+    return if options[:skip_side_effects]
+
     # Batch by source account
     statuses.group_by(&:account_id).each_value do |account_statuses|
       account = account_statuses.first.account