mirror of https://github.com/tootsuite/mastodon
Fix post rising to top of trends because of future date
parent
1e71c4e247
commit
17445e368e
|
@ -89,8 +89,8 @@ class ActivityPub::Activity::Create < ActivityPub::Activity
|
||||||
text: converted_object_type? ? converted_text : (@status_parser.text || ''),
|
text: converted_object_type? ? converted_text : (@status_parser.text || ''),
|
||||||
language: @status_parser.language,
|
language: @status_parser.language,
|
||||||
spoiler_text: converted_object_type? ? '' : (@status_parser.spoiler_text || ''),
|
spoiler_text: converted_object_type? ? '' : (@status_parser.spoiler_text || ''),
|
||||||
created_at: @status_parser.created_at,
|
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 ? @status_parser.edited_at : nil,
|
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],
|
override_timestamps: @options[:override_timestamps],
|
||||||
reply: @status_parser.reply,
|
reply: @status_parser.reply,
|
||||||
sensitive: @account.sensitized? || @status_parser.sensitive || false,
|
sensitive: @account.sensitized? || @status_parser.sensitive || false,
|
||||||
|
|
|
@ -123,7 +123,7 @@ class Trends::Statuses < Trends::Base
|
||||||
decaying_score = if score.zero? || !eligible?(status)
|
decaying_score = if score.zero? || !eligible?(status)
|
||||||
0
|
0
|
||||||
else
|
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
|
end
|
||||||
|
|
||||||
[decaying_score, status]
|
[decaying_score, status]
|
||||||
|
|
Loading…
Reference in New Issue