mirror of
https://github.com/mastodon/mastodon.git
synced 2024-08-20 21:08:15 -07:00
This commit is contained in:
parent
f0c939c431
commit
6e4046fc3f
1 changed files with 7 additions and 2 deletions
|
@ -3,10 +3,11 @@
|
||||||
class ActivityPub::ActivitySerializer < ActiveModel::Serializer
|
class ActivityPub::ActivitySerializer < ActiveModel::Serializer
|
||||||
attributes :id, :type, :actor, :published, :to, :cc
|
attributes :id, :type, :actor, :published, :to, :cc
|
||||||
|
|
||||||
has_one :proper, key: :object, serializer: ActivityPub::NoteSerializer
|
has_one :proper, key: :object, serializer: ActivityPub::NoteSerializer, unless: :announce?
|
||||||
|
attribute :proper_uri, key: :object, if: :announce?
|
||||||
|
|
||||||
def id
|
def id
|
||||||
[ActivityPub::TagManager.instance.activity_uri_for(object)].join
|
ActivityPub::TagManager.instance.activity_uri_for(object)
|
||||||
end
|
end
|
||||||
|
|
||||||
def type
|
def type
|
||||||
|
@ -29,6 +30,10 @@ class ActivityPub::ActivitySerializer < ActiveModel::Serializer
|
||||||
ActivityPub::TagManager.instance.cc(object)
|
ActivityPub::TagManager.instance.cc(object)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def proper_uri
|
||||||
|
ActivityPub::TagManager.instance.uri_for(object.proper)
|
||||||
|
end
|
||||||
|
|
||||||
def announce?
|
def announce?
|
||||||
object.reblog?
|
object.reblog?
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue