Migration: Exporting user blocks

closes #8263
This commit is contained in:
Thorsten Claus 2021-07-02 08:33:45 +02:00 committed by Benjamin Neff
parent 7b73002a2c
commit b31f9106a1
No known key found for this signature in database
GPG key ID: 971464C3F1A90194
4 changed files with 10 additions and 3 deletions

View file

@ -8,6 +8,7 @@
## 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

View file

@ -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}

View file

@ -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
}

View file

@ -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