forked from treehouse/mastodon
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.signup-info-prompt
parent
dcf1139ebd
commit
17bf3363ac
|
@ -11,7 +11,12 @@ class ActivityPub::Activity::Announce < ActivityPub::Activity
|
||||||
|
|
||||||
return status unless status.nil?
|
return status unless status.nil?
|
||||||
|
|
||||||
status = Status.create!(account: @account, reblog: original_status, uri: @json['id'])
|
status = Status.create!(
|
||||||
|
account: @account,
|
||||||
|
reblog: original_status,
|
||||||
|
uri: @json['id'],
|
||||||
|
created_at: @json['published'] || Time.now.utc
|
||||||
|
)
|
||||||
distribute(status)
|
distribute(status)
|
||||||
status
|
status
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class ActivityPub::ActivitySerializer < ActiveModel::Serializer
|
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
|
has_one :proper, key: :object, serializer: ActivityPub::NoteSerializer
|
||||||
|
|
||||||
|
@ -17,6 +17,10 @@ class ActivityPub::ActivitySerializer < ActiveModel::Serializer
|
||||||
ActivityPub::TagManager.instance.uri_for(object.account)
|
ActivityPub::TagManager.instance.uri_for(object.account)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def published
|
||||||
|
object.created_at.iso8601
|
||||||
|
end
|
||||||
|
|
||||||
def to
|
def to
|
||||||
ActivityPub::TagManager.instance.to(object)
|
ActivityPub::TagManager.instance.to(object)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue