From 40a3537b0591deebaa072700e7015ef584812377 Mon Sep 17 00:00:00 2001 From: Daniel Holmgren Date: Tue, 12 Mar 2024 16:01:40 -0500 Subject: [PATCH] Allow 3p labelers to query appview account infos (#2297) allow 3p labelers to query appview account infos --- .../src/api/com/atproto/admin/getAccountInfos.ts | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/packages/bsky/src/api/com/atproto/admin/getAccountInfos.ts b/packages/bsky/src/api/com/atproto/admin/getAccountInfos.ts index cee84d53177..971839d5afd 100644 --- a/packages/bsky/src/api/com/atproto/admin/getAccountInfos.ts +++ b/packages/bsky/src/api/com/atproto/admin/getAccountInfos.ts @@ -5,18 +5,25 @@ import { INVALID_HANDLE } from '@atproto/syntax' export default function (server: Server, ctx: AppContext) { server.com.atproto.admin.getAccountInfos({ - auth: ctx.authVerifier.roleOrModService, - handler: async ({ params }) => { + auth: ctx.authVerifier.optionalStandardOrRole, + handler: async ({ params, auth }) => { const { dids } = params + const { canViewTakedowns } = ctx.authVerifier.parseCreds(auth) + const actors = await ctx.hydrator.actor.getActors(dids, true) const infos = mapDefined(dids, (did) => { const info = actors.get(did) if (!info) return + if (info.takedownRef && !canViewTakedowns) return + const profileRecord = + !info.profileTakedownRef || canViewTakedowns + ? info.profile + : undefined return { did, handle: info.handle ?? INVALID_HANDLE, - relatedRecords: info.profile ? [info.profile] : undefined, + relatedRecords: profileRecord ? [profileRecord] : undefined, indexedAt: (info.sortedAt ?? new Date(0)).toISOString(), } })