Merge branch 'fix-followers-and-following-when-no-kind-0' into 'main'
Render followers & following list when the accounts do not have a kind 0 Closes #134 See merge request soapbox-pub/ditto!271
This commit is contained in:
commit
80e487817e
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