Class: ActivityPub::CommentSerializer
- Inherits:
-
ApplicationSerializer
- Object
- BaseSerializer
- ApplicationSerializer
- ActivityPub::CommentSerializer
- Defined in:
- app/serializers/activity_pub/comment_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
48 49 50 51 52 53 54 55 56 |
# File 'app/serializers/activity_pub/comment_serializer.rb', line 48 def cc [ @object.commentable&.federails_actor&.followers_url, @object.commenter&.federails_actor&.followers_url, (@object.commentable&.creator&.federails_actor&.followers_url if @object.commentable.respond_to?(:creator)), (@object.commentable&.collection&.federails_actor&.followers_url if @object.commentable.respond_to?(:collection)), (@object.commentable&.collections&.map { |c| c.federails_actor&.followers_url } if @object.commentable.respond_to?(:collections)) ].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 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'app/serializers/activity_pub/comment_serializer.rb', line 3 def serialize { "@context" => Federails::Utils::Context.generate(additional: [ "https://purl.archive.org/miscellany", { f3di: "http://purl.org/f3di/ns#", gts: "https://gotosocial.org/ns#", interactionPolicy: { "@id": "gts:interactionPolicy", "@type": "@id" }, canQuote: { "@id": "gts:canQuote", "@type": "@id" }, automaticApproval: { "@id": "gts:automaticApproval", "@type": "@id" }, Hashtag: "as:Hashtag", sensitive: "as:sensitive" } ]), "id" => @object.federated_url, "type" => "Note", "attributedTo" => @object.federails_actor.federated_url, "published" => @object.created_at, "updated" => @object.updated_at, "context" => Rails.application.routes.url_helpers.url_for([@object.commentable, {only_path: false}]), "sensitive" => @object.sensitive, "summary" => (@object.sensitive ? "Sensitive Content" : nil), # Adding a summary if sensitive, for Mastodon "content" => content, "tag" => , "f3di:compatibilityNote" => @object.system, "inReplyTo" => in_reply_to, "url" => url, "likes" => likes, "interactionPolicy" => @object.system ? { "canQuote" => { "automaticApproval" => Fediverse::Collection::PUBLIC } } : nil }.compact.merge(address_fields) end |