about summary refs log tree commit diff
path: root/app/services/follow_remote_account_service.rb
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2016-02-28 14:26:26 +0100
committerEugen Rochko <eugen@zeonfederated.com>2016-02-28 14:26:26 +0100
commitad5ae3f60e5e0745912bfbc0926f6cf8bc6e9eb4 (patch)
tree628535474e7f446869cab55f8cdcde56798229be /app/services/follow_remote_account_service.rb
parent2825991e09272d6e7227da9d9b8dc387614a83df (diff)
Update profile information and download avatar of remote accounts
Diffstat (limited to 'app/services/follow_remote_account_service.rb')
-rw-r--r--app/services/follow_remote_account_service.rb15
1 files changed, 5 insertions, 10 deletions
diff --git a/app/services/follow_remote_account_service.rb b/app/services/follow_remote_account_service.rb
index 8e0199134..f52a3a222 100644
--- a/app/services/follow_remote_account_service.rb
+++ b/app/services/follow_remote_account_service.rb
@@ -58,16 +58,7 @@ class FollowRemoteAccountService < BaseService
 
   def get_profile(xml, account)
     author = xml.at_xpath('/xmlns:feed/xmlns:author')
-
-    if author.at_xpath('./poco:displayName').nil?
-      account.display_name = account.username
-    else
-      account.display_name = author.at_xpath('./poco:displayName').content
-    end
-
-    unless author.at_xpath('./poco:note').nil?
-      account.note = author.at_xpath('./poco:note').content
-    end
+    update_remote_profile_service.(author, account)
   end
 
   def magic_key_to_pem(magic_key)
@@ -81,6 +72,10 @@ class FollowRemoteAccountService < BaseService
     key.to_pem
   end
 
+  def update_remote_profile_service
+    @update_remote_profile_service ||= UpdateRemoteProfileService.new
+  end
+
   def http_client
     HTTP
   end