FIX: Sort admin dashboard new updates by latest (#12146)

This commit is contained in:
Penar Musaraj 2021-02-19 11:03:36 -05:00 committed by GitHub
parent aac9e6cb0a
commit 7ee660a017
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 4 deletions

View File

@ -664,7 +664,6 @@
.new-feature-content { .new-feature-content {
padding-right: 0.5em; padding-right: 0.5em;
align-self: center;
.header { .header {
font-size: $font-up-1; font-size: $font-up-1;
font-weight: bold; font-weight: bold;

View File

@ -133,7 +133,7 @@ module DiscourseUpdates
item["discourse_version"].nil? || Discourse.has_needed_version?(Discourse::VERSION::STRING, item["discourse_version"]) rescue nil item["discourse_version"].nil? || Discourse.has_needed_version?(Discourse::VERSION::STRING, item["discourse_version"]) rescue nil
end end
entries.sort { |item| Time.zone.parse(item["created_at"]) } entries.sort_by { |item| Time.zone.parse(item["created_at"]).to_i }.reverse
end end
def has_unseen_features?(user_id) def has_unseen_features?(user_id)

View File

@ -202,8 +202,8 @@ describe DiscourseUpdates do
it 'correctly shows features by Discourse version' do it 'correctly shows features by Discourse version' do
features_with_versions = [ features_with_versions = [
{ "emoji" => "🤾", "title" => "Bells", "created_at" => 40.minutes.ago }, { "emoji" => "🤾", "title" => "Bells", "created_at" => 2.days.ago },
{ "emoji" => "🙈", "title" => "Whistles", "created_at" => 20.minutes.ago, discourse_version: "2.6.0.beta1" }, { "emoji" => "🙈", "title" => "Whistles", "created_at" => 120.minutes.ago, discourse_version: "2.6.0.beta1" },
{ "emoji" => "🙈", "title" => "Confetti", "created_at" => 15.minutes.ago, discourse_version: "2.7.0.beta2" }, { "emoji" => "🙈", "title" => "Confetti", "created_at" => 15.minutes.ago, discourse_version: "2.7.0.beta2" },
{ "emoji" => "🤾", "title" => "Not shown yet", "created_at" => 10.minutes.ago, discourse_version: "2.7.0.beta5" }, { "emoji" => "🤾", "title" => "Not shown yet", "created_at" => 10.minutes.ago, discourse_version: "2.7.0.beta5" },
{ "emoji" => "🤾", "title" => "Not shown yet (beta < stable)", "created_at" => 10.minutes.ago, discourse_version: "2.7.0" }, { "emoji" => "🤾", "title" => "Not shown yet (beta < stable)", "created_at" => 10.minutes.ago, discourse_version: "2.7.0" },