summaryrefslogtreecommitdiffstats
path: root/app/services/process_interaction_service.rb
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2016-09-04 14:43:00 +0200
committerEugen Rochko <eugen@zeonfederated.com>2016-09-04 14:44:16 +0200
commita289c1d52fa3330ecdfdaeeefdfbddb4b47c9be0 (patch)
tree9d88056102bf11c1e2ecdcbcd0701c427806c868 /app/services/process_interaction_service.rb
parent1022d682dc915bcbf3076c0280f29472068830bb (diff)
Handle delete Salmons, todo: clean up timelines
Diffstat (limited to 'app/services/process_interaction_service.rb')
-rw-r--r--app/services/process_interaction_service.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/app/services/process_interaction_service.rb b/app/services/process_interaction_service.rb
index b7503ca6ad0..536911e2f5f 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)