Add handler for salmons of undoing favourites

master
Eugen Rochko 8 years ago
parent 720ff55262
commit df63461ff0
  1. 8
      app/services/process_interaction_service.rb

@ -39,6 +39,8 @@ class ProcessInteractionService < BaseService
unfollow!(account, target_account) unfollow!(account, target_account)
when :favorite when :favorite
favourite!(xml, account) favourite!(xml, account)
when :unfavorite
unfavourite!(xml, account)
when :post when :post
add_post!(body, account) if mentions_account?(xml, target_account) add_post!(body, account) if mentions_account?(xml, target_account)
when :share when :share
@ -121,6 +123,12 @@ class ProcessInteractionService < BaseService
NotifyService.new.call(current_status.account, favourite) NotifyService.new.call(current_status.account, favourite)
end 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) def add_post!(body, account)
process_feed_service.call(body, account) process_feed_service.call(body, account)
end end

Loading…
Cancel
Save