Conditionally set chat declaration (#4122)
This commit is contained in:
		
							parent
							
								
									f52db843ad
								
							
						
					
					
						commit
						5771ff4b56
					
				
					 1 changed files with 12 additions and 9 deletions
				
			
		|  | @ -154,15 +154,18 @@ export async function createAgentAndCreateAccount( | ||||||
|             id: TID.nextStr(), |             id: TID.nextStr(), | ||||||
|           }, |           }, | ||||||
|         ]) |         ]) | ||||||
|         await agent.api.com.atproto.repo.putRecord({ | 
 | ||||||
|           repo: account.did, |         if (getAge(birthDate) < 18) { | ||||||
|           collection: 'chat.bsky.actor.declaration', |           await agent.api.com.atproto.repo.putRecord({ | ||||||
|           rkey: 'self', |             repo: account.did, | ||||||
|           record: { |             collection: 'chat.bsky.actor.declaration', | ||||||
|             $type: 'chat.bsky.actor.declaration', |             rkey: 'self', | ||||||
|             allowIncoming: getAge(birthDate) < 18 ? 'none' : 'following', |             record: { | ||||||
|           }, |               $type: 'chat.bsky.actor.declaration', | ||||||
|         }) |               allowIncoming: 'none', | ||||||
|  |             }, | ||||||
|  |           }) | ||||||
|  |         } | ||||||
|       }) |       }) | ||||||
|     } catch (e: any) { |     } catch (e: any) { | ||||||
|       logger.error(e, { |       logger.error(e, { | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue