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'), ])), ]; },