From 3ef5f13ee6baffbec68593c4ddc4f99bfec65201 Mon Sep 17 00:00:00 2001 From: Thibaut Girka Date: Fri, 5 Jul 2019 21:34:03 +0200 Subject: port glitch-soc@e5f4d83 to monsterfork: Allow serializing local-only toots in backup service Fixes #1153 --- app/serializers/activitypub/note_serializer.rb | 4 ++-- app/services/backup_service.rb | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'app') diff --git a/app/serializers/activitypub/note_serializer.rb b/app/serializers/activitypub/note_serializer.rb index 3492069cc..878b4bf13 100644 --- a/app/serializers/activitypub/note_serializer.rb +++ b/app/serializers/activitypub/note_serializer.rb @@ -34,8 +34,8 @@ class ActivityPub::NoteSerializer < ActivityPub::Serializer end def id - raise Mastodon::NotPermittedError, 'Local-only statuses should not be serialized' if object.local_only? - raise Mastodon::NotPermittedError, 'Hidden statuses should not be serialized' if object.hidden + raise Mastodon::NotPermittedError, 'Local-only statuses should not be serialized' if object.local_only && !instance_options[:allow_local_only] + raise Mastodon::NotPermittedError, 'Hidden statuses should not be serialized' if object.hidden && !instance_options[:allow_local_only] ActivityPub::TagManager.instance.uri_for(object) end diff --git a/app/services/backup_service.rb b/app/services/backup_service.rb index 5fcc98057..bd9e77223 100644 --- a/app/services/backup_service.rb +++ b/app/services/backup_service.rb @@ -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 -- cgit