The code powering m.abunchtell.com https://m.abunchtell.com
Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 
 

20 linhas
675 B

  1. # frozen_string_literal: true
  2. class UnfollowService < BaseService
  3. # Unfollow and notify the remote user
  4. # @param [Account] source_account Where to unfollow from
  5. # @param [Account] target_account Which to unfollow
  6. def call(source_account, target_account)
  7. follow = source_account.unfollow!(target_account)
  8. return unless follow
  9. NotificationWorker.perform_async(build_xml(follow), source_account.id, target_account.id) unless target_account.local?
  10. UnmergeWorker.perform_async(target_account.id, source_account.id)
  11. end
  12. private
  13. def build_xml(follow)
  14. OStatus::AtomSerializer.render(OStatus::AtomSerializer.new.unfollow_salmon(follow))
  15. end
  16. end