diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2017-02-12 19:50:18 +0100 |
---|---|---|
committer | Eugen Rochko <eugen@zeonfederated.com> | 2017-02-12 19:50:18 +0100 |
commit | df63461ff091f6b513c797d010f82dee73f437b2 (patch) | |
tree | 15a4a531987e5bb873269e8b5c755e906690f932 /app/services | |
parent | 720ff55262fec0abc630a613a4f3564b98b689dc (diff) |
Add handler for salmons of undoing favourites
Diffstat (limited to 'app/services')
-rw-r--r-- | app/services/process_interaction_service.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/app/services/process_interaction_service.rb b/app/services/process_interaction_service.rb index 8420ca351..c74ff9e22 100644 --- a/app/services/process_interaction_service.rb +++ b/app/services/process_interaction_service.rb @@ -39,6 +39,8 @@ class ProcessInteractionService < BaseService unfollow!(account, target_account) when :favorite favourite!(xml, account) + when :unfavorite + unfavourite!(xml, account) when :post add_post!(body, account) if mentions_account?(xml, target_account) when :share @@ -121,6 +123,12 @@ class ProcessInteractionService < BaseService NotifyService.new.call(current_status.account, favourite) end + def unfavourite!(xml, from_account) + current_status = status(xml) + favourite = current_status.favourites.where(account: from_account).first + favourite&.destroy + end + def add_post!(body, account) process_feed_service.call(body, account) end |