mirror of
https://github.com/RetroShare/RSNewWebUI.git
synced 2026-09-12 19:50:04 +05:00
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.
This commit is contained in:
parent
de06c5fcae
commit
7e50f5c5d6
@ -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;
|
||||
}
|
||||
|
||||
@ -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'),
|
||||
])),
|
||||
];
|
||||
},
|
||||
|
||||
Loading…
Reference in New Issue
Block a user