]> cat aescling's git repositories - mastodon.git/commitdiff
Rename "locked" to "manuallyApprovesFollowers" in ActivityPub (#4779)
authorEugen Rochko <eugen@zeonfederated.com>
Sat, 2 Sep 2017 21:13:35 +0000 (23:13 +0200)
committerGitHub <noreply@github.com>
Sat, 2 Sep 2017 21:13:35 +0000 (23:13 +0200)
See: <https://www.w3.org/wiki/Activity_Streams_extensions#as:manuallyApprovesFollowers>

app/lib/activitypub/adapter.rb
app/serializers/activitypub/actor_serializer.rb
app/services/activitypub/process_account_service.rb

index fe4dddd38e0f6f10d4083318310e4f225545cd2e..6ed66a23937ff209057c7e35bf6ad093f35dd95e 100644 (file)
@@ -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
index f004dc326a9dd898412a4926b315a37039c49d20..25521eca946f641a8f9f0b1c4c49be59b5f62c00 100644 (file)
@@ -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
index 44798d051f69b5396126cdaa38fd4cdb5c77983e..a26b39cb5241acbfc71a4525f6a1bc70e8b7d8a4 100644 (file)
@@ -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