commit
c727eae441
@ -1,5 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class ActivityPub::CollectionPresenter < ActiveModelSerializers::Model
|
||||
attributes :id, :type, :current, :size, :items
|
||||
attributes :id, :type, :size, :items
|
||||
end
|
||||
|
@ -0,0 +1,15 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class ActivityPub::AcceptFollowSerializer < ActiveModel::Serializer
|
||||
attributes :type, :actor
|
||||
|
||||
has_one :object, serializer: ActivityPub::FollowSerializer
|
||||
|
||||
def type
|
||||
'Accept'
|
||||
end
|
||||
|
||||
def actor
|
||||
ActivityPub::TagManager.instance.uri_for(object.target_account)
|
||||
end
|
||||
end
|
@ -0,0 +1,18 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class ActivityPub::BlockSerializer < ActiveModel::Serializer
|
||||
attributes :type, :actor
|
||||
attribute :virtual_object, key: :object
|
||||
|
||||
def type
|
||||
'Block'
|
||||
end
|
||||
|
||||
def actor
|
||||
ActivityPub::TagManager.instance.uri_for(object.account)
|
||||
end
|
||||
|
||||
def virtual_object
|
||||
ActivityPub::TagManager.instance.uri_for(object.target_account)
|
||||
end
|
||||
end
|
@ -0,0 +1,18 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class ActivityPub::DeleteSerializer < ActiveModel::Serializer
|
||||
attributes :type, :actor
|
||||
attribute :virtual_object, key: :object
|
||||
|
||||
def type
|
||||
'Delete'
|
||||
end
|
||||
|
||||
def actor
|
||||
ActivityPub::TagManager.instance.uri_for(object.account)
|
||||
end
|
||||
|
||||
def virtual_object
|
||||
ActivityPub::TagManager.instance.uri_for(object)
|
||||
end
|
||||
end
|
@ -0,0 +1,18 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class ActivityPub::FollowSerializer < ActiveModel::Serializer
|
||||
attributes :type, :actor
|
||||
attribute :virtual_object, key: :object
|
||||
|
||||
def type
|
||||
'Follow'
|
||||
end
|
||||
|
||||
def actor
|
||||
ActivityPub::TagManager.instance.uri_for(object.account)
|
||||
end
|
||||
|
||||
def virtual_object
|
||||
ActivityPub::TagManager.instance.uri_for(object.target_account)
|
||||
end
|
||||
end
|
@ -0,0 +1,18 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class ActivityPub::LikeSerializer < ActiveModel::Serializer
|
||||
attributes :type, :actor
|
||||
attribute :virtual_object, key: :object
|
||||
|
||||
def type
|
||||
'Like'
|
||||
end
|
||||
|
||||
def actor
|
||||
ActivityPub::TagManager.instance.uri_for(object.account)
|
||||
end
|
||||
|
||||
def virtual_object
|
||||
ActivityPub::TagManager.instance.uri_for(object.status)
|
||||
end
|
||||
end
|
@ -0,0 +1,17 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class ActivityPub::PublicKeySerializer < ActiveModel::Serializer
|
||||
attributes :id, :owner, :public_key_pem
|
||||
|
||||
def id
|
||||
[ActivityPub::TagManager.instance.uri_for(object), '#main-key'].join
|
||||
end
|
||||
|
||||
def owner
|
||||
ActivityPub::TagManager.instance.uri_for(object)
|
||||
end
|
||||
|
||||
def public_key_pem
|
||||
object.public_key
|
||||
end
|
||||
end
|
@ -0,0 +1,15 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class ActivityPub::RejectFollowSerializer < ActiveModel::Serializer
|
||||
attributes :type, :actor
|
||||
|
||||
has_one :object, serializer: ActivityPub::FollowSerializer
|
||||
|
||||
def type
|
||||
'Reject'
|
||||
end
|
||||
|
||||
def actor
|
||||
ActivityPub::TagManager.instance.uri_for(object.target_account)
|
||||
end
|
||||
end
|
@ -0,0 +1,15 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class ActivityPub::UndoBlockSerializer < ActiveModel::Serializer
|
||||
attributes :type, :actor
|
||||
|
||||
has_one :object, serializer: ActivityPub::BlockSerializer
|
||||
|
||||
def type
|
||||
'Undo'
|
||||
end
|
||||
|
||||
def actor
|
||||
ActivityPub::TagManager.instance.uri_for(object.account)
|
||||
end
|
||||
end
|
@ -0,0 +1,15 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class ActivityPub::UndoFollowSerializer < ActiveModel::Serializer
|
||||
attributes :type, :actor
|
||||
|
||||
has_one :object, serializer: ActivityPub::FollowSerializer
|
||||
|
||||
def type
|
||||
'Undo'
|
||||
end
|
||||
|
||||
def actor
|
||||
ActivityPub::TagManager.instance.uri_for(object.account)
|
||||
end
|
||||
end
|
@ -0,0 +1,15 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class ActivityPub::UndoLikeSerializer < ActiveModel::Serializer
|
||||
attributes :type, :actor
|
||||
|
||||
has_one :object, serializer: ActivityPub::LikeSerializer
|
||||
|
||||
def type
|
||||
'Undo'
|
||||
end
|
||||
|
||||
def actor
|
||||
ActivityPub::TagManager.instance.uri_for(object.account)
|
||||
end
|
||||
end
|
@ -0,0 +1,15 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class ActivityPub::UpdateSerializer < ActiveModel::Serializer
|
||||
attributes :type, :actor
|
||||
|
||||
has_one :object, serializer: ActivityPub::ActorSerializer
|
||||
|
||||
def type
|
||||
'Update'
|
||||
end
|
||||
|
||||
def actor
|
||||
ActivityPub::TagManager.instance.uri_for(object)
|
||||
end
|
||||
end
|
Loading…
Reference in new issue