Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow 3p labelers to query appview account infos #2297

Merged
merged 1 commit into from
Mar 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions packages/bsky/src/api/com/atproto/admin/getAccountInfos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to apply takedown labels here as well?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I lean towards no since it's not an application route, & I would expect most ozone instances to want to get as much info as possible. But not opposed to adding it, in some ways it's simpler 🤷‍♂️

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(),
}
})
Expand Down
Loading