about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--app/services/activitypub/process_account_service.rb10
-rw-r--r--spec/services/resolve_account_service_spec.rb1
2 files changed, 10 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])
 
diff --git a/spec/services/resolve_account_service_spec.rb b/spec/services/resolve_account_service_spec.rb
index f4c810f75..dd7561587 100644
--- a/spec/services/resolve_account_service_spec.rb
+++ b/spec/services/resolve_account_service_spec.rb
@@ -116,6 +116,7 @@ RSpec.describe ResolveAccountService, type: :service do
         expect(account.activitypub?).to eq true
         expect(account.domain).to eq 'ap.example.com'
         expect(account.inbox_url).to eq 'https://ap.example.com/users/foo/inbox'
+        expect(account.actor_type).to eq 'Person'
       end
     end