Set snowflake IDs for backdated statuses (#5260)
- Rename Mastodon::TimestampIds into Mastodon::Snowflake for clarity - Skip for statuses coming from inbox, aka delivered in real-time - Skip for statuses that claim to be from the future
This commit is contained in:
parent
6e4046fc3f
commit
0717d9b3e6
16 changed files with 83 additions and 43 deletions
|
@ -3,10 +3,11 @@
|
|||
class ActivityPub::Activity
|
||||
include JsonLdHelper
|
||||
|
||||
def initialize(json, account)
|
||||
def initialize(json, account, options = {})
|
||||
@json = json
|
||||
@account = account
|
||||
@object = @json['object']
|
||||
@options = options
|
||||
end
|
||||
|
||||
def perform
|
||||
|
@ -14,9 +15,9 @@ class ActivityPub::Activity
|
|||
end
|
||||
|
||||
class << self
|
||||
def factory(json, account)
|
||||
def factory(json, account, options = {})
|
||||
@json = json
|
||||
klass&.new(json, account)
|
||||
klass&.new(json, account, options)
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
@ -15,8 +15,9 @@ class ActivityPub::Activity::Announce < ActivityPub::Activity
|
|||
account: @account,
|
||||
reblog: original_status,
|
||||
uri: @json['id'],
|
||||
created_at: @json['published'] || Time.now.utc
|
||||
created_at: @options[:override_timestamps] ? nil : @json['published']
|
||||
)
|
||||
|
||||
distribute(status)
|
||||
status
|
||||
end
|
||||
|
|
|
@ -43,7 +43,7 @@ class ActivityPub::Activity::Create < ActivityPub::Activity
|
|||
text: text_from_content || '',
|
||||
language: language_from_content,
|
||||
spoiler_text: @object['summary'] || '',
|
||||
created_at: @object['published'] || Time.now.utc,
|
||||
created_at: @options[:override_timestamps] ? nil : @object['published'],
|
||||
reply: @object['inReplyTo'].present?,
|
||||
sensitive: @object['sensitive'] || false,
|
||||
visibility: visibility_from_audience,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue