about summary refs log tree commit diff
path: root/src/state/session/agent.ts
diff options
context:
space:
mode:
authorEric Bailey <git@esb.lol>2024-05-17 15:38:47 -0500
committerGitHub <noreply@github.com>2024-05-17 15:38:47 -0500
commit1b47ea7367c7d0f37557d8f07329c3b6f97a5e03 (patch)
tree4d738b08b30bbf914855b48ae31ff951faee9fae /src/state/session/agent.ts
parentcef243bcf47235b16f0dba54c917fb8c37757c96 (diff)
downloadvoidsky-1b47ea7367c7d0f37557d8f07329c3b6f97a5e03.tar.zst
Set chat declaration upon signup (#4084)
Diffstat (limited to 'src/state/session/agent.ts')
-rw-r--r--src/state/session/agent.ts10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/state/session/agent.ts b/src/state/session/agent.ts
index 9633dc0e3..3de4cad26 100644
--- a/src/state/session/agent.ts
+++ b/src/state/session/agent.ts
@@ -9,6 +9,7 @@ import {
   TIMELINE_SAVED_FEED,
 } from '#/lib/constants'
 import {tryFetchGates} from '#/lib/statsig/statsig'
+import {getAge} from '#/lib/strings/time'
 import {logger} from '#/logger'
 import {
   configureModerationForAccount,
@@ -153,6 +154,15 @@ export async function createAgentAndCreateAccount(
             id: TID.nextStr(),
           },
         ])
+        await agent.api.com.atproto.repo.putRecord({
+          repo: account.did,
+          collection: 'chat.bsky.actor.declaration',
+          rkey: 'self',
+          record: {
+            $type: 'chat.bsky.actor.declaration',
+            allowIncoming: getAge(birthDate) < 18 ? 'none' : 'following',
+          },
+        })
       })
     } catch (e: any) {
       logger.error(e, {