logo

mastofe

My custom branche(s) on git.pleroma.social/pleroma/mastofe git clone https://hacktivis.me/git/mastofe.git

relationship_worker.rb (678B)


  1. # frozen_string_literal: true
  2. class Import::RelationshipWorker
  3. include Sidekiq::Worker
  4. sidekiq_options queue: 'pull', retry: 8, dead: false
  5. def perform(account_id, target_account_uri, relationship)
  6. from_account = Account.find(account_id)
  7. target_account = ResolveAccountService.new.call(target_account_uri)
  8. return if target_account.nil?
  9. case relationship
  10. when 'follow'
  11. FollowService.new.call(from_account, target_account.acct)
  12. when 'block'
  13. BlockService.new.call(from_account, target_account)
  14. when 'mute'
  15. MuteService.new.call(from_account, target_account)
  16. end
  17. rescue ActiveRecord::RecordNotFound
  18. true
  19. end
  20. end