diff --git a/src/controllers/api/timelines.ts b/src/controllers/api/timelines.ts index a2c4367..677bc60 100644 --- a/src/controllers/api/timelines.ts +++ b/src/controllers/api/timelines.ts @@ -56,12 +56,17 @@ async function renderStatuses(c: AppContext, filters: NostrFilter[]) { return c.json([]); } - const statuses = await Promise.all(events.map((event) => { + const statuses = (await Promise.all(events.map((event) => { if (event.kind === 6) { return renderReblog(event); } return renderStatus(event, c.get('pubkey')); - })); + }))).filter((boolean) => boolean); + + if (!statuses.length) { + return c.json([]); + } + return paginated(c, events, statuses); } diff --git a/src/views/mastodon/statuses.ts b/src/views/mastodon/statuses.ts index e01e955..cac79ef 100644 --- a/src/views/mastodon/statuses.ts +++ b/src/views/mastodon/statuses.ts @@ -111,6 +111,7 @@ async function renderReblog(event: DittoEvent) { if (!event.repost) return; const reblog = await renderStatus(event.repost); + reblog.reblogged = true; return { id: event.id, account: await renderAccount(event.author),