diff options
| -rw-r--r-- | src/features/messages.js | 13 | ||||
| -rw-r--r-- | tools/chat-layout-test.js | 5 |
2 files changed, 14 insertions, 4 deletions
diff --git a/src/features/messages.js b/src/features/messages.js index 9745717..02a19b4 100644 --- a/src/features/messages.js +++ b/src/features/messages.js @@ -1178,6 +1178,10 @@ export function messagesFeature(ctx) { folded: null, controlEntries: [], guestEntries: [], + // the wraps this room opened: a room rebuilt with fresher keys hands + // them back to seenWraps, or its new subscription would skip the + // replay and fold without them + wrapIds: new Set(), members: new Map(), byChannel: new Map(), edits: new Map(), @@ -1253,6 +1257,7 @@ export function messagesFeature(ctx) { subscribeOn(room.relays, { kinds: [1059], authors: [room.control.pk], limit: 500 }, (wrap) => { if (seenWraps.has(wrap.id)) return; seenWraps.add(wrap.id); + room.wrapIds.add(wrap.id); openWrapBg(wrap, room.control, (opened) => { if (!opened || opened.rumor.kind !== 3308) return; room.controlEntries.push(opened); @@ -1262,6 +1267,7 @@ export function messagesFeature(ctx) { subscribeOn(room.relays, { kinds: [1059], authors: [room.guestbook.pk], limit: 500 }, (wrap) => { if (seenWraps.has(wrap.id)) return; seenWraps.add(wrap.id); + room.wrapIds.add(wrap.id); openWrapBg(wrap, room.guestbook, (opened) => { if (!opened) return; room.guestEntries.push(opened); @@ -1288,6 +1294,7 @@ export function messagesFeature(ctx) { const u = subscribeOn(room.relays, { kinds: [1059, 21059], authors: [stream.pk], limit: 200 }, (wrap) => { if (seenWraps.has(wrap.id)) return; seenWraps.add(wrap.id); + room.wrapIds.add(wrap.id); openWrapBg(wrap, stream, (opened) => { if (!opened) return; onChat(room, id, opened); @@ -2508,7 +2515,11 @@ export function messagesFeature(ctx) { if (!newer && !fill) continue; Object.assign(have, jmSubset(jm), { name: have.name || jm.name, relays: have.relays && have.relays.length ? have.relays : jm.relays }); const stale = rooms.get(have.community_id); // rebuilt with the new keys on next open - if (stale) { for (const u of stale.unsubs || []) { try { u(); } catch {} } rooms.delete(have.community_id); } + if (stale) { + for (const u of stale.unsubs || []) { try { u(); } catch {} } + for (const id of stale.wrapIds || []) seenWraps.delete(id); + rooms.delete(have.community_id); + } changed = true; continue; } diff --git a/tools/chat-layout-test.js b/tools/chat-layout-test.js index 34c8dc0..875f75b 100644 --- a/tools/chat-layout-test.js +++ b/tools/chat-layout-test.js @@ -51,9 +51,8 @@ try { await page.type('textarea', generateMnemonic(wordlist)); await click('button', 'Open wallet'); await waitText('receive', 15000); - // .header-msgs is the shared header-button class — settings, lock and - // search wear it too, and the first one is no longer this one - await page.evaluate(() => [...document.querySelectorAll('button')] + // Messages is a button in the bottom nav + await page.evaluate(() => [...document.querySelectorAll('.app-nav-button')] .find((b) => /message/i.test(b.getAttribute('aria-label') || ''))?.click()); await sleep(800); await click('button', 'Create'); |
