diff options
-rw-r--r-- | src/state/models/content/post-thread.ts | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/state/models/content/post-thread.ts b/src/state/models/content/post-thread.ts index 85ed13cb4..7e3650948 100644 --- a/src/state/models/content/post-thread.ts +++ b/src/state/models/content/post-thread.ts @@ -296,7 +296,11 @@ function sortThread(item: MaybeThreadItem) { if (modScore(a.moderation) !== modScore(b.moderation)) { return modScore(a.moderation) - modScore(b.moderation) } - return b.post.indexedAt.localeCompare(a.post.indexedAt) // newest + if (a.post.likeCount === b.post.likeCount) { + return b.post.indexedAt.localeCompare(a.post.indexedAt) // newest + } else { + return (b.post.likeCount || 0) - (a.post.likeCount || 0) // most likes + } }) item.replies.forEach(reply => sortThread(reply)) } |