about summary refs log tree commit diff
path: root/app/services/activitypub/process_account_service.rb
diff options
context:
space:
mode:
authorSurinna Curtis <ekiru.0@gmail.com>2018-05-08 06:30:04 -0500
committerEugen Rochko <eugen@zeonfederated.com>2018-05-08 13:30:04 +0200
commit01dfd6dbc8905dfaa5ab81fb9b38e52079e5ed7f (patch)
tree1c862c8317632494b6377a91fc74b0aecf807b59 /app/services/activitypub/process_account_service.rb
parentb1938d7853f1d52f9bd99244c550cc609dd81202 (diff)
Take the first recognized actor_type. (#7410)
Diffstat (limited to 'app/services/activitypub/process_account_service.rb')
-rw-r--r--app/services/activitypub/process_account_service.rb10
1 files changed, 9 insertions, 1 deletions
diff --git a/app/services/activitypub/process_account_service.rb b/app/services/activitypub/process_account_service.rb
index cc416b671..721c9c928 100644
--- a/app/services/activitypub/process_account_service.rb
+++ b/app/services/activitypub/process_account_service.rb
@@ -71,7 +71,7 @@ class ActivityPub::ProcessAccountService < BaseService
     @account.note                    = @json['summary'] || ''
     @account.locked                  = @json['manuallyApprovesFollowers'] || false
     @account.fields                  = property_values || {}
-    @account.actor_type              = @json['type']
+    @account.actor_type              = actor_type
   end
 
   def set_fetchable_attributes!
@@ -96,6 +96,14 @@ class ActivityPub::ProcessAccountService < BaseService
     ActivityPub::SynchronizeFeaturedCollectionWorker.perform_async(@account.id)
   end
 
+  def actor_type
+    if @json['type'].is_a?(Array)
+      @json['type'].find { |type| ActivityPub::FetchRemoteAccountService::SUPPORTED_TYPES.include?(type) }
+    else
+      @json['type']
+    end
+  end
+
   def image_url(key)
     value = first_of_value(@json[key])