aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/features/messages.js13
1 files changed, 12 insertions, 1 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;
}