From 922951d74c2025395b415a1cb22c1fea50a68529 Mon Sep 17 00:00:00 2001 From: thePR0M3TH3AN <53631862+PR0M3TH3AN@users.noreply.github.com> Date: Fri, 9 Jan 2026 15:53:26 -0500 Subject: [PATCH] Add session actor fallback for watch history --- js/watchHistoryService.js | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/js/watchHistoryService.js b/js/watchHistoryService.js index 499b525a..04274f4b 100644 --- a/js/watchHistoryService.js +++ b/js/watchHistoryService.js @@ -687,12 +687,22 @@ async function publishView(pointerInput, createdAt) { return viewResult; } - const actorCandidate = + let actorCandidate = viewResult?.event?.pubkey || nostrClient?.pubkey || nostrClient?.sessionActor?.pubkey || ""; - const actorKey = normalizeActorKey(actorCandidate); + let actorKey = normalizeActorKey(actorCandidate); + let usedSessionFallback = false; + if (!actorKey && typeof nostrClient?.ensureSessionActor === "function") { + await nostrClient.ensureSessionActor(); + const sessionActorKey = normalizeActorKey(nostrClient?.sessionActor?.pubkey); + if (sessionActorKey) { + actorKey = sessionActorKey; + actorCandidate = nostrClient?.sessionActor?.pubkey || ""; + usedSessionFallback = true; + } + } if (!actorKey) { userLogger.warn( "[watchHistoryService] Unable to resolve actor for watch list update.", @@ -700,6 +710,12 @@ async function publishView(pointerInput, createdAt) { ); return viewResult; } + if (usedSessionFallback) { + devLogger.info( + "[watchHistoryService] Using session actor fallback for watch history update.", + { actor: actorKey } + ); + } const queue = ensureQueue(actorKey); if (!queue) {