diff options
author | Eric Bailey <git@esb.lol> | 2024-08-21 21:20:45 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-21 19:20:45 -0700 |
commit | 6616a6467ec53aa71e5f823c2d8c46dc01442703 (patch) | |
tree | 5e49d6916bc9b9fc71a475cf0d02f169c744bf59 /src/state/queries/post-thread.ts | |
parent | 56ab5e177fa2b24d0e5d9d969aa37532b96128da (diff) | |
download | voidsky-6616a6467ec53aa71e5f823c2d8c46dc01442703.tar.zst |
Detached QPs and hidden replies (#4878)
Co-authored-by: Hailey <me@haileyok.com>
Diffstat (limited to 'src/state/queries/post-thread.ts')
-rw-r--r-- | src/state/queries/post-thread.ts | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/state/queries/post-thread.ts b/src/state/queries/post-thread.ts index fd419d1c4..3370c3617 100644 --- a/src/state/queries/post-thread.ts +++ b/src/state/queries/post-thread.ts @@ -138,6 +138,7 @@ export function sortThread( modCache: ThreadModerationCache, currentDid: string | undefined, justPostedUris: Set<string>, + threadgateRecordHiddenReplies: Set<string>, ): ThreadNode { if (node.type !== 'post') { return node @@ -185,6 +186,14 @@ export function sortThread( return 1 // current account's reply } + const aHidden = threadgateRecordHiddenReplies.has(a.uri) + const bHidden = threadgateRecordHiddenReplies.has(b.uri) + if (aHidden && !aIsBySelf && !bHidden) { + return 1 + } else if (bHidden && !bIsBySelf && !aHidden) { + return -1 + } + const aBlur = Boolean(modCache.get(a)?.ui('contentList').blur) const bBlur = Boolean(modCache.get(b)?.ui('contentList').blur) if (aBlur !== bBlur) { @@ -222,7 +231,14 @@ export function sortThread( return b.post.indexedAt.localeCompare(a.post.indexedAt) }) node.replies.forEach(reply => - sortThread(reply, opts, modCache, currentDid, justPostedUris), + sortThread( + reply, + opts, + modCache, + currentDid, + justPostedUris, + threadgateRecordHiddenReplies, + ), ) } return node |