diff options
author | Shel R <Yiskah.Raphen@gmail.com> | 2017-04-07 21:59:21 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-04-07 21:59:21 -0400 |
commit | 4c05f0e630aacad594e7b21147340e2c0a0ac8ad (patch) | |
tree | 4ef28c2f42dd8e4cdfd9815dd6550b5bd2601f36 /app/services/follow_remote_account_service.rb | |
parent | 96812a6c792c8b048ed8d4a50351d9696dcf0f77 (diff) | |
parent | d438eab67301e767bdd040c6f9bd831c92214656 (diff) |
Merge branch 'master' into patch-1
Diffstat (limited to 'app/services/follow_remote_account_service.rb')
-rw-r--r-- | app/services/follow_remote_account_service.rb | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/app/services/follow_remote_account_service.rb b/app/services/follow_remote_account_service.rb index b39eafc70..936953429 100644 --- a/app/services/follow_remote_account_service.rb +++ b/app/services/follow_remote_account_service.rb @@ -45,13 +45,13 @@ class FollowRemoteAccountService < BaseService account.suspended = true if domain_block && domain_block.suspend? account.silenced = true if domain_block && domain_block.silence? - xml = get_feed(account.remote_url) - hubs = get_hubs(xml) + body, xml = get_feed(account.remote_url) + hubs = get_hubs(xml) account.uri = get_account_uri(xml) account.hub_url = hubs.first.attribute('href').value - get_profile(xml, account) + get_profile(body, account) account.save! account @@ -61,7 +61,7 @@ class FollowRemoteAccountService < BaseService def get_feed(url) response = http_client.get(Addressable::URI.parse(url)) - Nokogiri::XML(response) + [response.to_s, Nokogiri::XML(response)] end def get_hubs(xml) @@ -82,12 +82,8 @@ class FollowRemoteAccountService < BaseService author_uri.content end - def get_profile(xml, account) - update_remote_profile_service.call(xml.at_xpath('/xmlns:feed'), account) - end - - def update_remote_profile_service - @update_remote_profile_service ||= UpdateRemoteProfileService.new + def get_profile(body, account) + RemoteProfileUpdateWorker.perform_async(account.id, body.force_encoding('UTF-8'), false) end def http_client |