logo

mastofe

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

after_remote_follow_request_worker.rb (737B)


  1. # frozen_string_literal: true
  2. class AfterRemoteFollowRequestWorker
  3. include Sidekiq::Worker
  4. sidekiq_options queue: 'pull', retry: 5
  5. attr_reader :follow_request
  6. def perform(follow_request_id)
  7. @follow_request = FollowRequest.find(follow_request_id)
  8. process_follow_service if processing_required?
  9. rescue ActiveRecord::RecordNotFound
  10. true
  11. end
  12. private
  13. def process_follow_service
  14. follow_request.destroy
  15. FollowService.new.call(follow_request.account, updated_account.acct)
  16. end
  17. def processing_required?
  18. !updated_account.nil? && !updated_account.locked?
  19. end
  20. def updated_account
  21. @_updated_account ||= FetchRemoteAccountService.new.call(follow_request.target_account.remote_url)
  22. end
  23. end