feat: renderAdminAccount() supports both kind 0 & kind 30361
This commit is contained in:
parent
f08211e2a1
commit
b57188943f
|
@ -3,9 +3,16 @@ import { nostrDate } from '@/utils.ts';
|
||||||
|
|
||||||
import { accountFromPubkey, renderAccount } from '@/views/mastodon/accounts.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) {
|
async function renderAdminAccount(event: DittoEvent) {
|
||||||
|
let account;
|
||||||
|
|
||||||
|
if (event.kind === 0 && event.user) {
|
||||||
|
account = await renderAccount(event);
|
||||||
|
} else {
|
||||||
const d = event.tags.find(([name]) => name === 'd')?.[1]!;
|
const d = event.tags.find(([name]) => name === 'd')?.[1]!;
|
||||||
const account = event.d_author ? await renderAccount({ ...event.d_author, user: event }) : await accountFromPubkey(d);
|
account = event.d_author ? await renderAccount({ ...event.d_author, user: event }) : await accountFromPubkey(d);
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
id: account.id,
|
id: account.id,
|
||||||
|
|
Loading…
Reference in New Issue