aboutsummaryrefslogtreecommitdiffstats
path: root/src/features/messages.js
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-09-22 11:24:34 -0700
committerAdam Soltys <[email protected]>2026-09-22 11:24:34 -0700
commit229746922fbd566ef9014845c2111c5044ac91fa (patch)
tree074d800cef61ce3c75bdfd7731828d8ad2f0280d /src/features/messages.js
parentff0038baed91f79722c3a3ac71651cdd1fc145e8 (diff)
downloadcoinosv3-229746922fbd566ef9014845c2111c5044ac91fa.tar.gz
coinosv3-229746922fbd566ef9014845c2111c5044ac91fa.zip
Ark: receives waiting with another server are claimed; notifications belong to the identity.
Once per session the wallet visits every other Ark server it holds state with — its own manager, a receive rescan, a sync to claim — and says what arrived and where; the coins wait there until a switch back. The stored notification list remembers which identity fetched it, so another identity on the same wallet starts empty instead of reading the previous one's. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01Tmfg8k5f3TbNJS34qiqHAp
Diffstat (limited to 'src/features/messages.js')
-rw-r--r--src/features/messages.js9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/features/messages.js b/src/features/messages.js
index b97ff8d..e5bc300 100644
--- a/src/features/messages.js
+++ b/src/features/messages.js
@@ -7063,9 +7063,14 @@ export function messagesFeature(ctx) {
let notif = null; // { status, items }
let notifAt = 0, notifUnsub = null;
const notifSeen = () => st().notifSeen || 0;
+ // Notifications are about the IDENTITY, not the wallet: the stored list
+ // remembers whose it is, and another identity on the same wallet starts
+ // empty instead of reading the previous one's.
+ const identityPk = () => (hook('nostrLoginIdentity') || {}).pubkey || (wallet.nostr && wallet.nostr.pk) || null;
function notifNow() {
if (!notif) {
- const stored = st().notifs || [];
+ const s = st();
+ const stored = (!s.notifsPk || s.notifsPk === identityPk()) ? (s.notifs || []) : [];
notif = { status: stored.length ? 'ready' : 'loading', items: stored };
refreshNotifs();
}
@@ -7116,7 +7121,7 @@ export function messagesFeature(ctx) {
c.items = kept.slice(0, NOTIF_KEEP);
// the rows already say who; a reply row also wants its reader-facing text,
// which it carries — the events themselves are not kept
- const s2 = st(); s2.notifs = c.items; save(s2);
+ const s2 = st(); s2.notifs = c.items; s2.notifsPk = identityPk(); save(s2);
// a reply is a note we can open straight away; keep it in hand
for (const ev of evs) if (ev.kind === 1) notifNotes.set(ev.id, ev);
return true;