From 965bcc44dc6b5c5fa9d013b32da3cc9f8fdce93a Mon Sep 17 00:00:00 2001 From: dan Date: Sat, 16 Nov 2024 22:02:33 +0000 Subject: [PATCH] Sort pins last in thread view (#6426) --- src/state/queries/post-thread.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/state/queries/post-thread.ts b/src/state/queries/post-thread.ts index 103a1d03b5..93e3a5c3bc 100644 --- a/src/state/queries/post-thread.ts +++ b/src/state/queries/post-thread.ts @@ -216,6 +216,17 @@ export function sortThread( } } + const aPin = Boolean(a.record.text.trim() === '📌') + const bPin = Boolean(b.record.text.trim() === '📌') + if (aPin !== bPin) { + if (aPin) { + return 1 + } + if (bPin) { + return -1 + } + } + if (opts.prioritizeFollowedUsers) { const af = a.post.author.viewer?.following const bf = b.post.author.viewer?.following