Browse Source

Add handler for salmons of undoing favourites

closed-social-glitch-2
Eugen Rochko 7 years ago
parent
commit
df63461ff0
1 changed files with 8 additions and 0 deletions
  1. +8
    -0
      app/services/process_interaction_service.rb

+ 8
- 0
app/services/process_interaction_service.rb 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

Loading…
Cancel
Save