about summary refs log tree commit diff
path: root/app/services/send_interaction_service.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/services/send_interaction_service.rb')
-rw-r--r--app/services/send_interaction_service.rb14
1 files changed, 12 insertions, 2 deletions
diff --git a/app/services/send_interaction_service.rb b/app/services/send_interaction_service.rb
index 99113eeca..504f41c72 100644
--- a/app/services/send_interaction_service.rb
+++ b/app/services/send_interaction_service.rb
@@ -6,12 +6,22 @@ class SendInteractionService < BaseService
   # @param [Account] source_account
   # @param [Account] target_account
   def call(xml, source_account, target_account)
-    envelope = salmon.pack(xml, source_account.keypair)
-    salmon.post(target_account.salmon_url, envelope)
+    @xml            = xml
+    @source_account = source_account
+    @target_account = target_account
+
+    return if block_notification?
+
+    envelope = salmon.pack(@xml, @source_account.keypair)
+    salmon.post(@target_account.salmon_url, envelope)
   end
 
   private
 
+  def block_notification?
+    DomainBlock.blocked?(@target_account.domain)
+  end
+
   def salmon
     @salmon ||= OStatus2::Salmon.new
   end