diff --git a/Changelog.md b/Changelog.md index e206bb038..036083042 100644 --- a/Changelog.md +++ b/Changelog.md @@ -46,6 +46,7 @@ Although the chat was never enabled per default and was marked as experimental, ## Features * Add tags to tumblr posts [#8244](https://github.com/diaspora/diaspora/pull/8244) +* Add blocks to the archive export [#8263](https://github.com/diaspora/diaspora/pull/8263) # 0.7.15.0 diff --git a/app/models/block.rb b/app/models/block.rb index 147361cac..48254071a 100644 --- a/app/models/block.rb +++ b/app/models/block.rb @@ -4,7 +4,7 @@ class Block < ApplicationRecord belongs_to :person belongs_to :user - delegate :name, to: :person, prefix: true + delegate :name, :diaspora_handle, to: :person, prefix: true validates :person_id, uniqueness: {scope: :user_id} diff --git a/app/serializers/export/user_serializer.rb b/app/serializers/export/user_serializer.rb index f1c4db5a3..dcf435b6b 100644 --- a/app/serializers/export/user_serializer.rb +++ b/app/serializers/export/user_serializer.rb @@ -10,7 +10,8 @@ module Export :show_community_spotlight_in_stream, :auto_follow_back, :auto_follow_back_aspect, - :strip_exif + :strip_exif, + :blocks has_one :profile, serializer: FederationEntitySerializer has_many :contact_groups, each_serializer: Export::AspectSerializer has_many :contacts, each_serializer: Export::ContactSerializer @@ -45,6 +46,10 @@ module Export } end + def blocks + object.blocks.map(&:person_diaspora_handle) + end + %i[comments likes poll_participations].each {|collection| delegate collection, to: :person } diff --git a/lib/schemas/archive-format.json b/lib/schemas/archive-format.json index 0bb79017e..79105232d 100644 --- a/lib/schemas/archive-format.json +++ b/lib/schemas/archive-format.json @@ -20,7 +20,12 @@ ] }, "strip_exif": { "type": "boolean" }, - + "blocks": { + "type": "array", + "items" : { + "type": "string" + } + }, "profile": { "$ref": "https://diaspora.github.io/diaspora_federation/schemas/federation_entities.json#/definitions/profile" }, diff --git a/spec/serializers/export/user_serializer_spec.rb b/spec/serializers/export/user_serializer_spec.rb index 52fa11e43..9720b5459 100644 --- a/spec/serializers/export/user_serializer_spec.rb +++ b/spec/serializers/export/user_serializer_spec.rb @@ -14,7 +14,8 @@ describe Export::UserSerializer do show_community_spotlight_in_stream: user.show_community_spotlight_in_stream, auto_follow_back: user.auto_follow_back, auto_follow_back_aspect: user.auto_follow_back_aspect, - strip_exif: user.strip_exif + strip_exif: user.strip_exif, + blocks: user.blocks ) end