1
0
Fork 0
mirror of https://github.com/mastodon/mastodon.git synced 2024-08-20 21:08:15 -07:00

Add handler for salmons of undoing favourites

This commit is contained in:
Eugen Rochko 2017-02-12 19:50:18 +01:00
parent 720ff55262
commit df63461ff0

View file

@ -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