Fix latests discussions for full mode

This commit is contained in:
dtonon 2026-06-15 15:24:41 +02:00
parent 826c806f96
commit ed1775aeb5

View file

@ -103,14 +103,16 @@ export async function loadOverview(roomIds: string[]) {
}); });
admins = adm; admins = adm;
// Most recent discussions (thread OPs) across all rooms combined. // Most recent discussions (thread OPs) across all rooms. The group relay
const threads = await querySync(relay, { // truncates multi-value "#h" filters, so query each room and merge.
kinds: [11], const perRoom = await Promise.all(
"#h": roomIds, roomIds.map((id) =>
limit: 20, querySync(relay, { kinds: [11], "#h": [id], limit: 20 }),
}); ),
);
const threads = perRoom.flat();
threads.sort((a, b) => b.created_at - a.created_at); threads.sort((a, b) => b.created_at - a.created_at);
recent = threads.map((e) => ({ recent = threads.slice(0, 20).map((e) => ({
id: e.id, id: e.id,
title: e.tags.find((t) => t[0] === "title")?.[1] ?? "(untitled)", title: e.tags.find((t) => t[0] === "title")?.[1] ?? "(untitled)",
groupId: e.tags.find((t) => t[0] === "h")?.[1] ?? "", groupId: e.tags.find((t) => t[0] === "h")?.[1] ?? "",