about summary refs log tree commit diff
path: root/src/state/session
diff options
context:
space:
mode:
authorEric Bailey <git@esb.lol>2024-05-20 14:41:24 -0500
committerGitHub <noreply@github.com>2024-05-20 14:41:24 -0500
commit5771ff4b56f235a5f356d55a92dce0b45f7a4679 (patch)
tree5a068066fe2c5c1b2cb9a11e949f3d47bbadbc46 /src/state/session
parentf52db843adf91050cf0456172e472617664a9eb9 (diff)
downloadvoidsky-5771ff4b56f235a5f356d55a92dce0b45f7a4679.tar.zst
Conditionally set chat declaration (#4122)
Diffstat (limited to 'src/state/session')
-rw-r--r--src/state/session/agent.ts21
1 files changed, 12 insertions, 9 deletions
diff --git a/src/state/session/agent.ts b/src/state/session/agent.ts
index 3de4cad26..972d33425 100644
--- a/src/state/session/agent.ts
+++ b/src/state/session/agent.ts
@@ -154,15 +154,18 @@ 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',
-          },
-        })
+
+        if (getAge(birthDate) < 18) {
+          await agent.api.com.atproto.repo.putRecord({
+            repo: account.did,
+            collection: 'chat.bsky.actor.declaration',
+            rkey: 'self',
+            record: {
+              $type: 'chat.bsky.actor.declaration',
+              allowIncoming: 'none',
+            },
+          })
+        }
       })
     } catch (e: any) {
       logger.error(e, {