From e954af88ec81d7e99926f3b1ad09d3f5677b4d6f Mon Sep 17 00:00:00 2001 From: Ryan Wang Date: Wed, 28 Sep 2022 14:52:16 +0800 Subject: [PATCH] perf: change the default sort order of articles (#2480) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #### What type of PR is this? /kind improvement /milestone 2.0 /area core #### What this PR does / why we need it: 修改文章列表的默认排序规则,之前是按照创建时间(createTime)升序,现在改为降序。即最新创建的文章在前面。 #### Special notes for your reviewer: 测试方式: 连续创建多篇文章,检查前后台的文章排序是否是最新的在最前面。 /cc @halo-dev/sig-halo #### Does this PR introduce a user-facing change? ```release-note None ``` --- src/main/java/run/halo/app/content/PostSorter.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/java/run/halo/app/content/PostSorter.java b/src/main/java/run/halo/app/content/PostSorter.java index 957ae0d82..7d66fe281 100644 --- a/src/main/java/run/halo/app/content/PostSorter.java +++ b/src/main/java/run/halo/app/content/PostSorter.java @@ -73,7 +73,6 @@ public enum PostSorter { Function createTime = post -> post.getMetadata().getCreationTimestamp(); return Comparator.comparing(createTime) - .thenComparing(name) - .reversed(); + .thenComparing(name); } }