fix: render followers & following list when no kind 0
This commit is contained in:
parent
5aacbe7af5
commit
4cc1d13d44
17
src/views.ts
17
src/views.ts
|
@ -5,6 +5,7 @@ import { renderAccount } from '@/views/mastodon/accounts.ts';
|
||||||
import { renderStatus } from '@/views/mastodon/statuses.ts';
|
import { renderStatus } from '@/views/mastodon/statuses.ts';
|
||||||
import { paginated, paginationSchema } from '@/utils/api.ts';
|
import { paginated, paginationSchema } from '@/utils/api.ts';
|
||||||
import { hydrateEvents } from '@/storages/hydrate.ts';
|
import { hydrateEvents } from '@/storages/hydrate.ts';
|
||||||
|
import { accountFromPubkey } from '@/views/mastodon/accounts.ts';
|
||||||
|
|
||||||
/** Render account objects for the author of each event. */
|
/** Render account objects for the author of each event. */
|
||||||
async function renderEventAccounts(c: AppContext, filters: NostrFilter[], signal = AbortSignal.timeout(1000)) {
|
async function renderEventAccounts(c: AppContext, filters: NostrFilter[], signal = AbortSignal.timeout(1000)) {
|
||||||
|
@ -24,7 +25,13 @@ async function renderEventAccounts(c: AppContext, filters: NostrFilter[], signal
|
||||||
.then((events) => hydrateEvents({ events, store, signal }));
|
.then((events) => hydrateEvents({ events, store, signal }));
|
||||||
|
|
||||||
const accounts = await Promise.all(
|
const accounts = await Promise.all(
|
||||||
authors.map((event) => renderAccount(event)),
|
Array.from(pubkeys).map(async (pubkey) => {
|
||||||
|
const event = authors.find((event) => event.pubkey === pubkey);
|
||||||
|
if (event) {
|
||||||
|
return await renderAccount(event);
|
||||||
|
}
|
||||||
|
return await accountFromPubkey(pubkey);
|
||||||
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
return paginated(c, events, accounts);
|
return paginated(c, events, accounts);
|
||||||
|
@ -39,7 +46,13 @@ async function renderAccounts(c: AppContext, authors: string[], signal = AbortSi
|
||||||
.then((events) => hydrateEvents({ events, store, signal }));
|
.then((events) => hydrateEvents({ events, store, signal }));
|
||||||
|
|
||||||
const accounts = await Promise.all(
|
const accounts = await Promise.all(
|
||||||
events.map((event) => renderAccount(event)),
|
authors.map(async (pubkey) => {
|
||||||
|
const event = events.find((event) => event.pubkey === pubkey);
|
||||||
|
if (event) {
|
||||||
|
return await renderAccount(event);
|
||||||
|
}
|
||||||
|
return await accountFromPubkey(pubkey);
|
||||||
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
return paginated(c, events, accounts);
|
return paginated(c, events, accounts);
|
||||||
|
|
Loading…
Reference in New Issue