Class: ActivityPub::ModelSerializer
- Inherits:
-
ApplicationSerializer
- Object
- BaseSerializer
- ApplicationSerializer
- ActivityPub::ModelSerializer
- Defined in:
- app/serializers/activity_pub/model_serializer.rb
Instance Method Summary collapse
Methods inherited from ApplicationSerializer
Methods inherited from BaseSerializer
#audience, #bcc, #bto, #federate?, #initialize, #to
Constructor Details
This class inherits a constructor from ActivityPub::BaseSerializer
Instance Method Details
#cc ⇒ Object
34 35 36 37 38 39 40 |
# File 'app/serializers/activity_pub/model_serializer.rb', line 34 def cc [ @object.federails_actor.followers_url, @object.creator&.federails_actor&.followers_url, @object.collections.map { |c| c.federails_actor&.followers_url } ].flatten.compact end |
#serialize ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'app/serializers/activity_pub/model_serializer.rb', line 3 def serialize raise ActiveRecord::RecordNotFound unless federate? # Temporary guard against publishing non-public Federails::ActorEntity objects { "@context": [ "https://purl.archive.org/miscellany", { spdx: "http://spdx.org/rdf/terms#", f3di: "http://purl.org/f3di/ns#", toot: "http://joinmastodon.org/ns#", Hashtag: "as:Hashtag", sensitive: "as:sensitive", indexable: "toot:indexable", discoverable: "toot:discoverable" } ], summary: @object.caption, content: @object.notes, "f3di:concreteType": "3DModel", attachment: @object.links.map { {type: "Link", href: it.url, name: it.text}.compact }, sensitive: @object.sensitive, indexable: @object.indexable?, discoverable: @object.indexable?, tag: , attributedTo: short_creator(@object.creator), context: @object.collections.map { |c| short_collection(c) }, "spdx:license": license, preview: (OEmbed::ModelSerializer.new(@object, maxwidth: "100%", maxheight: "100%").serialize), likes: likes }.compact.merge(address_fields) end |