From 4b1b0eb8137101191175be96862f448a71f9cf47 Mon Sep 17 00:00:00 2001 From: dholms Date: Tue, 26 Dec 2023 18:40:04 -0600 Subject: [PATCH] more tidy --- .../bsky/src/api/com/atproto/admin/util.ts | 52 ------------------- 1 file changed, 52 deletions(-) delete mode 100644 packages/bsky/src/api/com/atproto/admin/util.ts diff --git a/packages/bsky/src/api/com/atproto/admin/util.ts b/packages/bsky/src/api/com/atproto/admin/util.ts deleted file mode 100644 index 7dfd10cce5c..00000000000 --- a/packages/bsky/src/api/com/atproto/admin/util.ts +++ /dev/null @@ -1,52 +0,0 @@ -import AppContext from '../../../../context' -import { - RepoView, - RepoViewDetail, - AccountView, -} from '../../../../lexicon/types/com/atproto/admin/defs' - -export const getPdsAccountInfo = async ( - ctx: AppContext, - did: string, -): Promise => { - const agent = ctx.moderationPushAgent - if (!agent) return null - try { - const res = await agent.api.com.atproto.admin.getAccountInfo({ did }) - return res.data - } catch (err) { - return null - } -} - -export const addAccountInfoToRepoViewDetail = ( - repoView: RepoViewDetail, - accountInfo: AccountView | null, - includeEmail = false, -): RepoViewDetail => { - if (!accountInfo) return repoView - return { - ...repoView, - email: includeEmail ? accountInfo.email : undefined, - invitedBy: accountInfo.invitedBy, - invitesDisabled: accountInfo.invitesDisabled, - inviteNote: accountInfo.inviteNote, - invites: accountInfo.invites, - emailConfirmedAt: accountInfo.emailConfirmedAt, - } -} - -export const addAccountInfoToRepoView = ( - repoView: RepoView, - accountInfo: AccountView | null, - includeEmail = false, -): RepoView => { - if (!accountInfo) return repoView - return { - ...repoView, - email: includeEmail ? accountInfo.email : undefined, - invitedBy: accountInfo.invitedBy, - invitesDisabled: accountInfo.invitesDisabled, - inviteNote: accountInfo.inviteNote, - } -}