Conditionally set chat declaration (#4122)

zio/stable
Eric Bailey 2024-05-20 14:41:24 -05:00 committed by GitHub
parent f52db843ad
commit 5771ff4b56
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 12 additions and 9 deletions

View File

@ -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, {