diff --git a/src/views/mastodon/admin-accounts.ts b/src/views/mastodon/admin-accounts.ts index 8023161..90723f4 100644 --- a/src/views/mastodon/admin-accounts.ts +++ b/src/views/mastodon/admin-accounts.ts @@ -3,9 +3,16 @@ import { nostrDate } from '@/utils.ts'; import { accountFromPubkey, renderAccount } from '@/views/mastodon/accounts.ts'; +/** Expects a kind 0 fully hydrated or a kind 30361 hydrated with `d_author` */ async function renderAdminAccount(event: DittoEvent) { - const d = event.tags.find(([name]) => name === 'd')?.[1]!; - const account = event.d_author ? await renderAccount({ ...event.d_author, user: event }) : await accountFromPubkey(d); + let account; + + if (event.kind === 0 && event.user) { + account = await renderAccount(event); + } else { + const d = event.tags.find(([name]) => name === 'd')?.[1]!; + account = event.d_author ? await renderAccount({ ...event.d_author, user: event }) : await accountFromPubkey(d); + } return { id: account.id,