about summary refs log tree commit diff
path: root/src/state/queries/threadgate/util.ts
diff options
context:
space:
mode:
authorEric Bailey <git@esb.lol>2024-08-21 22:16:03 -0500
committerGitHub <noreply@github.com>2024-08-21 20:16:03 -0700
commitd5c78b9183ac78620f59538fed61c8130ae1c47a (patch)
tree53ad7c63b9263e508df587aa6d837c4036f394e9 /src/state/queries/threadgate/util.ts
parent61f0be705d614a31331945e1c4b9361d71b81403 (diff)
downloadvoidsky-d5c78b9183ac78620f59538fed61c8130ae1c47a.tar.zst
Prep threadgate shadow hack (#4970)
Co-authored-by: Hailey <me@haileyok.com>
Diffstat (limited to 'src/state/queries/threadgate/util.ts')
-rw-r--r--src/state/queries/threadgate/util.ts20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/state/queries/threadgate/util.ts b/src/state/queries/threadgate/util.ts
index 09ae0a0c1..35c33875e 100644
--- a/src/state/queries/threadgate/util.ts
+++ b/src/state/queries/threadgate/util.ts
@@ -139,3 +139,23 @@ export function createThreadgateRecord(
     hiddenReplies: threadgate.hiddenReplies || [],
   }
 }
+
+export function createTempThreadgateView({
+  postUri,
+  hiddenReplies,
+}: Pick<AppBskyFeedThreadgate.Record, 'hiddenReplies'> & {
+  postUri: string
+}): AppBskyFeedDefs.ThreadgateView {
+  const record: AppBskyFeedThreadgate.Record = {
+    $type: 'app.bsky.feed.threadgate',
+    post: postUri,
+    allow: undefined,
+    hiddenReplies,
+    createdAt: new Date().toISOString(),
+  }
+  return {
+    $type: 'app.bsky.feed.defs#threadgateView',
+    uri: postUri,
+    record,
+  }
+}