about summary refs log tree commit diff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/services/process_feed_service.rb2
-rw-r--r--app/services/process_interaction_service.rb12
-rw-r--r--app/services/remove_status_service.rb10
3 files changed, 23 insertions, 1 deletions
diff --git a/app/services/process_feed_service.rb b/app/services/process_feed_service.rb
index ba11fc4b1..d14b35e80 100644
--- a/app/services/process_feed_service.rb
+++ b/app/services/process_feed_service.rb
@@ -91,7 +91,7 @@ class ProcessFeedService < BaseService
   end
 
   def delete_post!(status)
-    status.destroy!
+    RemoveStatusService.new.(status)
   end
 
   def find_original_status(_xml, id)
diff --git a/app/services/process_interaction_service.rb b/app/services/process_interaction_service.rb
index b7503ca6a..536911e2f 100644
--- a/app/services/process_interaction_service.rb
+++ b/app/services/process_interaction_service.rb
@@ -32,6 +32,8 @@ class ProcessInteractionService < BaseService
         add_post!(body, account) if mentions_account?(xml, target_account)
       when :share
         add_post!(body, account) unless status(xml).nil?
+      when :delete
+        delete_post!(xml, account)
       end
     end
   end
@@ -62,6 +64,16 @@ class ProcessInteractionService < BaseService
     account.unfollow!(target_account)
   end
 
+  def delete_post!(xml, account)
+    status = Status.find(activity_id(xml))
+
+    return if status.nil?
+
+    if account.id == status.account_id
+      RemoveStatusService.new.(status)
+    end
+  end
+
   def favourite!(xml, from_account)
     current_status = status(xml)
     current_status.favourites.where(account: from_account).first_or_create!(account: from_account)
diff --git a/app/services/remove_status_service.rb b/app/services/remove_status_service.rb
new file mode 100644
index 000000000..1b5da6b2a
--- /dev/null
+++ b/app/services/remove_status_service.rb
@@ -0,0 +1,10 @@
+class RemoveStatusService < BaseService
+  def call(status)
+    status.destroy!
+
+    # TODO
+    # Remove from timelines of self, followers, and mentioned accounts
+    # For remote mentioned accounts, send delete Salmon
+    # Push delete event through ActionCable
+  end
+end