From: Eugen Rochko Date: Sun, 12 Feb 2017 18:50:18 +0000 (+0100) Subject: Add handler for salmons of undoing favourites X-Git-Url: https://git.xn--scling-oua.cat.family/?a=commitdiff_plain;h=df63461ff091f6b513c797d010f82dee73f437b2;p=mastodon.git Add handler for salmons of undoing favourites --- 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