about summary refs log tree commit diff
path: root/app/services
diff options
context:
space:
mode:
authorDavid Yip <yipdw@member.fsf.org>2018-04-14 09:12:50 -0500
committerDavid Yip <yipdw@member.fsf.org>2018-04-14 09:12:50 -0500
commit813da6788e5129579db04e89aac3076902af2c7a (patch)
tree2c7c8435e4eae5baa4b6169973c8da4644d44ded /app/services
parente3d0d72b299103d30fcda2b7175906c73c1571bc (diff)
parent78ed4ab75ff77d7cba60d478aa1f45d1c104785d (diff)
Merge remote-tracking branch 'origin/master' into gs-master
  Conflicts:
 	db/schema.rb
Diffstat (limited to 'app/services')
-rw-r--r--app/services/activitypub/process_account_service.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/app/services/activitypub/process_account_service.rb b/app/services/activitypub/process_account_service.rb
index 4475a9079..da32f9615 100644
--- a/app/services/activitypub/process_account_service.rb
+++ b/app/services/activitypub/process_account_service.rb
@@ -70,6 +70,7 @@ class ActivityPub::ProcessAccountService < BaseService
     @account.display_name            = @json['name'] || ''
     @account.note                    = @json['summary'] || ''
     @account.locked                  = @json['manuallyApprovesFollowers'] || false
+    @account.fields                  = property_values || {}
   end
 
   def set_fetchable_attributes!
@@ -126,6 +127,11 @@ class ActivityPub::ProcessAccountService < BaseService
     end
   end
 
+  def property_values
+    return unless @json['attachment'].is_a?(Array)
+    @json['attachment'].select { |attachment| attachment['type'] == 'PropertyValue' }.map { |attachment| attachment.slice('name', 'value') }
+  end
+
   def mismatching_origin?(url)
     needle   = Addressable::URI.parse(url).host
     haystack = Addressable::URI.parse(@uri).host