From 7e50f5c5d63f61745c5e9a1e2aa032ed55d155a8 Mon Sep 17 00:00:00 2001 From: jolavillette Date: Fri, 28 Aug 2026 03:17:10 +0200 Subject: [PATCH] webui v159: a refused invitation the core no longer has must leave the list Reported: Decline answers "RetroShare could not decline this invitation". denyLobbyInvite() returns false for exactly one reason -- the id is not in the core's invite queue, and DistributedChatService prints "lobby invite not in cache" when that happens. That queue lives in memory only, so a core restart empties it while this list still shows what it held before; the entry then can be neither accepted nor refused, and it keeps the Chat badge lit for good, which is what the Decline button was added to prevent. So a refusal the core does not recognise now removes the invitation here anyway and re-reads the queue, and says so. A request that gets no answer at all is kept apart: nothing was decided, so nothing is dropped. --- webui-src/app/chat/chat_state.js | 29 +++++++++++++++++++++++++++-- webui-src/app/main.js | 4 ++-- 2 files changed, 29 insertions(+), 4 deletions(-) diff --git a/webui-src/app/chat/chat_state.js b/webui-src/app/chat/chat_state.js index ee6208a..54dd2e0 100644 --- a/webui-src/app/chat/chat_state.js +++ b/webui-src/app/chat/chat_state.js @@ -436,8 +436,33 @@ const ChatRoomsModel = { '/rsChats/denyLobbyInvite', { id: { xstr64: lobbyId } }, (data, success) => { - if (!success || !data || !data.retval) { - this.joinError = 'RetroShare could not decline this invitation.'; + if (!success) { + // No answer at all: the core is unreachable or the endpoint is not + // in this build. Nothing was decided, so nothing is dropped here. + this.joinError = 'No answer from RetroShare, the invitation was left alone.'; + m.redraw(); + return; + } + if (!data || !data.retval) { + // denyLobbyInvite() only returns false for one reason: the id is not + // in the core's invite queue (DistributedChatService, "lobby invite + // not in cache"). The queue lives in memory only, so a core restart + // empties it while this list still shows what it held before. + // + // Either way the invitation is gone as far as the core is concerned, + // and keeping it here would leave the Chat badge lit over something + // that can never be accepted nor refused. Drop it and re-read the + // queue, so the list ends up saying what the core says. + this.invitationIds.delete(lobbyId); + this.allRooms = this.allRooms.filter( + (room) => rs.idToHex(room.lobby_id) !== lobbyId + ); + if (ChatHubState.selectedRoomId === lobbyId) { + ChatHubState.selectedRoomId = null; + ChatHubState.mobilePane = 'list'; + } + this.joinError = 'RetroShare no longer had this invitation; it has been removed from the list.'; + this.loadPendingInvitations(); m.redraw(); return; } diff --git a/webui-src/app/main.js b/webui-src/app/main.js index d964ebc..ada3765 100644 --- a/webui-src/app/main.js +++ b/webui-src/app/main.js @@ -137,7 +137,7 @@ const navbar = () => { ? 'Connected to RetroShare Core' : 'Connection Lost', }), - m('span.webui-version', { style: { fontSize: '0.7em' } }, 'v158'), + m('span.webui-version', { style: { fontSize: '0.7em' } }, 'v159'), m('i.fas.fa-sync-alt.refresh-icon', { style: { cursor: 'pointer', fontSize: '0.8em' }, onclick: () => window.location.reload(true), @@ -260,7 +260,7 @@ const MobileStatus = () => { m('small', statusbar.formatBytes(state.totalOut)), ]), ]), - m('.mobile-status-sheet__version', 'WebUI v158'), + m('.mobile-status-sheet__version', 'WebUI v159'), ])), ]; },