about summary refs log tree commit diff
path: root/app/serializers
diff options
context:
space:
mode:
authorunarist <m.unarist@gmail.com>2017-09-19 03:30:11 +0900
committerEugen Rochko <eugen@zeonfederated.com>2017-09-18 20:30:11 +0200
commit17bf3363ac600b72755167f82e059feb4fbffa87 (patch)
tree8e6d83f7a7d03faf70bd49820cf08d02fa88f97a /app/serializers
parentdcf1139ebd65375fd130d71c2e664827d00e9d4f (diff)
Add published property to ActivityPub activity for reblogs (#5000)
Since reblogs are serialized as Announce activity, its published property can be used for the creation time of reblog.
Diffstat (limited to 'app/serializers')
-rw-r--r--app/serializers/activitypub/activity_serializer.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/app/serializers/activitypub/activity_serializer.rb b/app/serializers/activitypub/activity_serializer.rb
index 349495e84..b252e008b 100644
--- a/app/serializers/activitypub/activity_serializer.rb
+++ b/app/serializers/activitypub/activity_serializer.rb
@@ -1,7 +1,7 @@
 # frozen_string_literal: true
 
 class ActivityPub::ActivitySerializer < ActiveModel::Serializer
-  attributes :id, :type, :actor, :to, :cc
+  attributes :id, :type, :actor, :published, :to, :cc
 
   has_one :proper, key: :object, serializer: ActivityPub::NoteSerializer
 
@@ -17,6 +17,10 @@ class ActivityPub::ActivitySerializer < ActiveModel::Serializer
     ActivityPub::TagManager.instance.uri_for(object.account)
   end
 
+  def published
+    object.created_at.iso8601
+  end
+
   def to
     ActivityPub::TagManager.instance.to(object)
   end