1
0
mirror of https://github.com/mastodon/mastodon synced 2024-11-27 22:38:27 +09:00

Fixes/do not override timestamps (#7331)

* Do not override timestamps for incoming toots

* Remove every reference to override_timestamps

Statuses are now created with the announced publishing date
and are only pushed to timelines if that date is at most
6 hours earlier than the time at which it is processed.
This commit is contained in:
ThibG 2018-05-03 13:33:08 +02:00 committed by Eugen Rochko
parent d5fa4fbcd2
commit 581a5c9d29
6 changed files with 7 additions and 7 deletions

View File

@ -80,7 +80,7 @@ class ActivityPub::Activity
# Only continue if the status is supposed to have
# arrived in real-time
return unless @options[:override_timestamps] || status.within_realtime_window?
return unless status.within_realtime_window?
distribute_to_followers(status)
end

View File

@ -15,7 +15,7 @@ class ActivityPub::Activity::Announce < ActivityPub::Activity
account: @account,
reblog: original_status,
uri: @json['id'],
created_at: @options[:override_timestamps] ? nil : @json['published'],
created_at: @json['published'],
visibility: original_status.visibility
)

View File

@ -47,7 +47,7 @@ class ActivityPub::Activity::Create < ActivityPub::Activity
text: text_from_content || '',
language: detected_language,
spoiler_text: @object['summary'] || '',
created_at: @options[:override_timestamps] ? nil : @object['published'],
created_at: @object['published'],
reply: @object['inReplyTo'].present?,
sensitive: @object['sensitive'] || false,
visibility: visibility_from_audience,

View File

@ -39,7 +39,7 @@ class OStatus::Activity::Creation < OStatus::Activity::Base
reblog: cached_reblog,
text: content,
spoiler_text: content_warning,
created_at: @options[:override_timestamps] ? nil : published,
created_at: published,
reply: thread?,
language: content_language,
visibility: visibility_scope,
@ -61,7 +61,7 @@ class OStatus::Activity::Creation < OStatus::Activity::Base
Rails.logger.debug "Queuing remote status #{status.id} (#{id}) for distribution"
LinkCrawlWorker.perform_async(status.id) unless status.spoiler_text?
DistributionWorker.perform_async(status.id) if @options[:override_timestamps] || status.within_realtime_window?
DistributionWorker.perform_async(status.id) if status.within_realtime_window?
status
end

View File

@ -6,6 +6,6 @@ class ActivityPub::ProcessingWorker
sidekiq_options backtrace: true
def perform(account_id, body)
ActivityPub::ProcessCollectionService.new.call(body, Account.find(account_id), override_timestamps: true)
ActivityPub::ProcessCollectionService.new.call(body, Account.find(account_id))
end
end

View File

@ -6,6 +6,6 @@ class ProcessingWorker
sidekiq_options backtrace: true
def perform(account_id, body)
ProcessFeedService.new.call(body, Account.find(account_id), override_timestamps: true)
ProcessFeedService.new.call(body, Account.find(account_id))
end
end