about summary refs log tree commit diff
diff options
context:
space:
mode:
authordan <dan.abramov@gmail.com>2024-11-16 22:02:33 +0000
committerGitHub <noreply@github.com>2024-11-16 22:02:33 +0000
commit965bcc44dc6b5c5fa9d013b32da3cc9f8fdce93a (patch)
tree2d712f49b1dbe99a5d41b810eae5b0f77cf6b1ca
parentedaf230612f688512c71a66a99742e558620ebd3 (diff)
downloadvoidsky-965bcc44dc6b5c5fa9d013b32da3cc9f8fdce93a.tar.zst
Sort pins last in thread view (#6426)
-rw-r--r--src/state/queries/post-thread.ts11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/state/queries/post-thread.ts b/src/state/queries/post-thread.ts
index 103a1d03b..93e3a5c3b 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