This commit is contained in:
Eugen Rochko
2018-01-08 10:57:52 +01:00
committed by GitHub
parent e4a241abef
commit dbda87c31f
10 changed files with 31 additions and 138 deletions

View File

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