]> cat aescling's git repositories - mastodon.git/commitdiff
Allow serializing local-only toots in backup service
authorThibaut Girka <thib@sitedethib.com>
Fri, 5 Jul 2019 19:34:03 +0000 (21:34 +0200)
committerThibG <thib@sitedethib.com>
Fri, 5 Jul 2019 19:50:19 +0000 (21:50 +0200)
Fixes #1153

app/serializers/activitypub/note_serializer.rb
app/services/backup_service.rb

index 7225b23192c5044358f8486c835798c9d31fd77f..61fa778528e11aea502ba5bfdf2942ebce50e6e9 100644 (file)
@@ -25,7 +25,7 @@ class ActivityPub::NoteSerializer < ActivityPub::Serializer
   attribute :closed, if: :poll_and_expired?
 
   def id
-    raise Mastodon::NotPermittedError, 'Local-only statuses should not be serialized' if object.local_only?
+    raise Mastodon::NotPermittedError, 'Local-only statuses should not be serialized' if object.local_only? && !instance_options[:allow_local_only]
     ActivityPub::TagManager.instance.uri_for(object)
   end
 
index 5fcc980570490dce3991d5cabaa60231469761c3..bd9e77223c5dff72dfa9ccfb42f216b6cf2a107c 100644 (file)
@@ -149,7 +149,8 @@ class BackupService < BaseService
     ActiveModelSerializers::SerializableResource.new(
       object,
       serializer: serializer,
-      adapter: ActivityPub::Adapter
+      adapter: ActivityPub::Adapter,
+      allow_local_only: true,
     ).as_json
   end