about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFire Demon <firedemon@creature.cafe>2020-10-27 18:47:32 -0500
committerFire Demon <firedemon@creature.cafe>2020-10-28 19:05:51 -0500
commitd4eeebb57c4e21f908ad5bbae2b920c31b711dd5 (patch)
tree28971cfb62521bcbbd896e4e486e66a457182386
parent747170006b273e17cb94f7cb938d831fb4a05c7c (diff)
If a user adds a hard mute, it no longer cause a defederation
-rw-r--r--app/services/after_block_service.rb4
-rw-r--r--app/services/mute_service.rb2
-rw-r--r--app/workers/block_worker.rb5
3 files changed, 7 insertions, 4 deletions
diff --git a/app/services/after_block_service.rb b/app/services/after_block_service.rb
index 3ee7e2e56..36f891988 100644
--- a/app/services/after_block_service.rb
+++ b/app/services/after_block_service.rb
@@ -1,7 +1,7 @@
 # frozen_string_literal: true
 
 class AfterBlockService < BaseService
-  def call(account, target_account)
+  def call(account, target_account, defederate: true)
     @account        = account
     @target_account = target_account
 
@@ -9,6 +9,8 @@ class AfterBlockService < BaseService
     clear_notifications!
     clear_conversations!
 
+    return unless defederate
+
     defederate_interactions!
     unlink_interactions!
   end
diff --git a/app/services/mute_service.rb b/app/services/mute_service.rb
index 67df92f5c..5e7e1d292 100644
--- a/app/services/mute_service.rb
+++ b/app/services/mute_service.rb
@@ -7,7 +7,7 @@ class MuteService < BaseService
     mute = account.mute!(target_account, notifications: notifications, timelines_only: timelines_only, duration: duration)
 
     if mute.hide_notifications?
-      BlockWorker.perform_async(account.id, target_account.id)
+      BlockWorker.perform_async(account.id, target_account.id, defederate: false)
     else
       MuteWorker.perform_async(account.id, target_account.id)
     end
diff --git a/app/workers/block_worker.rb b/app/workers/block_worker.rb
index 25f5dd808..89ba11b55 100644
--- a/app/workers/block_worker.rb
+++ b/app/workers/block_worker.rb
@@ -3,10 +3,11 @@
 class BlockWorker
   include Sidekiq::Worker
 
-  def perform(account_id, target_account_id)
+  def perform(account_id, target_account_id, defederate: true)
     AfterBlockService.new.call(
       Account.find(account_id),
-      Account.find(target_account_id)
+      Account.find(target_account_id),
+      defederate: defederate
     )
   end
 end