0
0
Fork 0

Allow to dereference Follow object for ActivityPub (#5772)

* Allow to dereference Follow object for ActivityPub

* Accept IRI as object representation for Accept activity
This commit is contained in:
Akihiko Odaki 2018-01-04 02:08:57 +09:00 committed by Eugen Rochko
parent 53d99ebf4f
commit 161c72d66d
10 changed files with 134 additions and 31 deletions

View file

@ -1,11 +1,12 @@
# frozen_string_literal: true
class ActivityPub::FollowSerializer < ActiveModel::Serializer
attributes :id, :type, :actor
attributes :type, :actor
attribute :id, if: :dereferencable?
attribute :virtual_object, key: :object
def id
[ActivityPub::TagManager.instance.uri_for(object.account), '#follows/', object.id].join
ActivityPub::TagManager.instance.uri_for(object)
end
def type
@ -19,4 +20,8 @@ class ActivityPub::FollowSerializer < ActiveModel::Serializer
def virtual_object
ActivityPub::TagManager.instance.uri_for(object.target_account)
end
def dereferencable?
object.respond_to?(:object_type)
end
end