about summary refs log tree commit diff
path: root/src/state/queries/threadgate/util.ts
diff options
context:
space:
mode:
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,
+  }
+}