The code powering m.abunchtell.com https://m.abunchtell.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

33 regels
970 B

  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, options = {})
  6. from_account = Account.find(account_id)
  7. target_account = ResolveAccountService.new.call(target_account_uri)
  8. options.symbolize_keys!
  9. return if target_account.nil?
  10. case relationship
  11. when 'follow'
  12. FollowService.new.call(from_account, target_account, options)
  13. when 'unfollow'
  14. UnfollowService.new.call(from_account, target_account)
  15. when 'block'
  16. BlockService.new.call(from_account, target_account)
  17. when 'unblock'
  18. UnblockService.new.call(from_account, target_account)
  19. when 'mute'
  20. MuteService.new.call(from_account, target_account, options)
  21. when 'unmute'
  22. UnmuteService.new.call(from_account, target_account)
  23. end
  24. rescue ActiveRecord::RecordNotFound
  25. true
  26. end
  27. end