闭社主体 forked from https://github.com/tootsuite/mastodon
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.

20 lines
539 B

  1. # frozen_string_literal: true
  2. class RemoteProfileUpdateWorker
  3. include Sidekiq::Worker
  4. sidekiq_options queue: 'pull'
  5. def perform(account_id, body, resubscribe)
  6. account = Account.find(account_id)
  7. xml = Nokogiri::XML(body)
  8. xml.encoding = 'utf-8'
  9. author_container = xml.at_xpath('/xmlns:feed', xmlns: TagManager::XMLNS) || xml.at_xpath('/xmlns:entry', xmlns: TagManager::XMLNS)
  10. UpdateRemoteProfileService.new.call(author_container, account, resubscribe)
  11. rescue ActiveRecord::RecordNotFound
  12. true
  13. end
  14. end