about summary refs log blame commit diff
path: root/app/serializers/activitypub/delete_serializer.rb
blob: 2bb65135f7c5c3ca7aca4ac2877f86926b6be1be (plain) (tree)
1
2
3
4
5

                                                             
                                                     
                                    








                                                      
                                                  

       
                               
                                                  
 


                                                                      





                                                            
   
# frozen_string_literal: true

class ActivityPub::DeleteSerializer < ActiveModel::Serializer
  class TombstoneSerializer < ActiveModel::Serializer
    attributes :id, :type, :atom_uri

    def id
      ActivityPub::TagManager.instance.uri_for(object)
    end

    def type
      'Tombstone'
    end

    def atom_uri
      OStatus::TagManager.instance.uri_for(object)
    end
  end

  attributes :id, :type, :actor

  has_one :object, serializer: TombstoneSerializer

  def id
    [ActivityPub::TagManager.instance.uri_for(object), '#delete'].join
  end

  def type
    'Delete'
  end

  def actor
    ActivityPub::TagManager.instance.uri_for(object.account)
  end
end