diaspora/app/serializers/federation_entity_serializer.rb
cmrd Senya 7374661e2f
Update the user data export archive format.
This commit introduces changes to the user data export archive format.
This extends data set which is included in the archive. This data can be
then imported to other pods when this feature is implemented.

Also the commit adds the archive format json schema. ATM it is used in
automatic tests only, but in future it will also be used to validate
incoming archives.
2017-08-10 09:36:26 +03:00

16 lines
535 B
Ruby

# This is an ActiveModel::Serializer based class which uses DiasporaFederation::Entity JSON serialization
# features in order to serialize local DB objects. To determine a type of entity class to use the same routines
# are used as for federation messages generation.
class FederationEntitySerializer < ActiveModel::Serializer
include SerializerPostProcessing
private
def modify_serializable_object(hash)
hash.merge(entity.to_json)
end
def entity
@entity ||= Diaspora::Federation::Entities.build(object)
end
end