diff options
author | Eric Bailey <git@esb.lol> | 2024-05-20 14:41:24 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-20 14:41:24 -0500 |
commit | 5771ff4b56f235a5f356d55a92dce0b45f7a4679 (patch) | |
tree | 5a068066fe2c5c1b2cb9a11e949f3d47bbadbc46 /src | |
parent | f52db843adf91050cf0456172e472617664a9eb9 (diff) | |
download | voidsky-5771ff4b56f235a5f356d55a92dce0b45f7a4679.tar.zst |
Conditionally set chat declaration (#4122)
Diffstat (limited to 'src')
-rw-r--r-- | src/state/session/agent.ts | 21 |
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, { |