From 37fdddd927614d550aa47f142e3adc32cf70810b Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Sat, 2 Sep 2017 23:13:35 +0200 Subject: [PATCH] Rename "locked" to "manuallyApprovesFollowers" in ActivityPub (#4779) See: --- app/lib/activitypub/adapter.rb | 15 +++++++-------- app/serializers/activitypub/actor_serializer.rb | 6 +++++- .../activitypub/process_account_service.rb | 2 +- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/app/lib/activitypub/adapter.rb b/app/lib/activitypub/adapter.rb index fe4dddd38e..6ed66a2393 100644 --- a/app/lib/activitypub/adapter.rb +++ b/app/lib/activitypub/adapter.rb @@ -7,14 +7,13 @@ class ActivityPub::Adapter < ActiveModelSerializers::Adapter::Base 'https://w3id.org/security/v1', { - 'locked' => 'as:locked', - 'sensitive' => 'as:sensitive', - 'Hashtag' => 'as:Hashtag', - - 'ostatus' => 'http://ostatus.org#', - 'atomUri' => 'ostatus:atomUri', - 'inReplyToAtomUri' => 'ostatus:inReplyToAtomUri', - 'conversation' => 'ostatus:conversation', + 'manuallyApprovesFollowers' => 'as:manuallyApprovesFollowers', + 'sensitive' => 'as:sensitive', + 'Hashtag' => 'as:Hashtag', + 'ostatus' => 'http://ostatus.org#', + 'atomUri' => 'ostatus:atomUri', + 'inReplyToAtomUri' => 'ostatus:inReplyToAtomUri', + 'conversation' => 'ostatus:conversation', }, ], }.freeze diff --git a/app/serializers/activitypub/actor_serializer.rb b/app/serializers/activitypub/actor_serializer.rb index f004dc326a..25521eca94 100644 --- a/app/serializers/activitypub/actor_serializer.rb +++ b/app/serializers/activitypub/actor_serializer.rb @@ -6,7 +6,7 @@ class ActivityPub::ActorSerializer < ActiveModel::Serializer attributes :id, :type, :following, :followers, :inbox, :outbox, :shared_inbox, :preferred_username, :name, :summary, - :url, :locked + :url, :manually_approves_followers has_one :public_key, serializer: ActivityPub::PublicKeySerializer @@ -90,4 +90,8 @@ class ActivityPub::ActorSerializer < ActiveModel::Serializer def header_exists? object.header.exists? end + + def manually_approves_followers + object.locked + end end diff --git a/app/services/activitypub/process_account_service.rb b/app/services/activitypub/process_account_service.rb index 44798d051f..a26b39cb52 100644 --- a/app/services/activitypub/process_account_service.rb +++ b/app/services/activitypub/process_account_service.rb @@ -50,7 +50,7 @@ class ActivityPub::ProcessAccountService < BaseService @account.avatar_remote_url = image_url('icon') @account.header_remote_url = image_url('image') @account.public_key = public_key || '' - @account.locked = @json['locked'] || false + @account.locked = @json['manuallyApprovesFollowers'] || false @account.save! end