1
0
mirror of https://github.com/mastodon/mastodon synced 2024-11-23 14:46:18 +09:00

Fix post rising to top of trends because of future date

This commit is contained in:
Eugen Rochko 2024-11-09 21:31:17 +01:00
parent 1e71c4e247
commit 17445e368e
2 changed files with 3 additions and 3 deletions

View File

@ -89,8 +89,8 @@ class ActivityPub::Activity::Create < ActivityPub::Activity
text: converted_object_type? ? converted_text : (@status_parser.text || ''),
language: @status_parser.language,
spoiler_text: converted_object_type? ? '' : (@status_parser.spoiler_text || ''),
created_at: @status_parser.created_at,
edited_at: @status_parser.edited_at && @status_parser.edited_at != @status_parser.created_at ? @status_parser.edited_at : nil,
created_at: [Time.now.utc, @status_parser.created_at].compact.min,
edited_at: @status_parser.edited_at && @status_parser.edited_at != @status_parser.created_at ? [Time.now.utc, @status_parser.edited_at].compact.min : nil,
override_timestamps: @options[:override_timestamps],
reply: @status_parser.reply,
sensitive: @account.sensitized? || @status_parser.sensitive || false,

View File

@ -123,7 +123,7 @@ class Trends::Statuses < Trends::Base
decaying_score = if score.zero? || !eligible?(status)
0
else
score * (0.5**((at_time.to_f - status.created_at.to_f) / options[:score_halflife].to_f))
score * (0.5**((at_time.to_f - [at_time.to_f, status.created_at.to_f].min) / options[:score_halflife].to_f))
end
[decaying_score, status]