Skip to content

Commit

Permalink
fixes igniterealtime#48: Remove spinner when chat request fails
Browse files Browse the repository at this point in the history
When an end-user requests a chat through the embedded Converse client, a spinner starts running that ends when the chat starts.

When all agents reject the request, the user leaves the queue. Before this commit, the end-user was not visually informed of this (the spinner kept on spinning). This commit replaces the spinner with the chat button again (allowing for a retry).

There is probably a lot to improve on this, but that's beyond my capabilities with Converse.
  • Loading branch information
guusdk committed Jan 15, 2021
1 parent beec873 commit 64d9a35
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions classes/ofmeet.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,21 @@ var ofmeet = (function(of)
console.error('join workgroup error', err);
document.getElementById("chatloader").style.visibility = "hidden";
});

_converse.connection.addHandler(function(message) {
if (message.querySelector('depart-queue')) {
console.info("joining workgroup failed - departed the queue")
document.getElementById("chatloader").style.visibility = "hidden";
document.getElementById("chatbutton").style.visibility = "visible";
// TODO: give some kind of feedback to the end-user, explaining why this has happened.

// Got a 'depart-queue' message: remove this handler by returning 'false'.
return false; // TODO this handler should also be removed after successfully joining a room.
} else {
// Did not get a 'depart-queue' message: retain this handler by returning 'true'.
return true
}
}, 'http://jabber.org/protocol/workgroup','message');
}

function getFastPathStatus(callback)
Expand Down

0 comments on commit 64d9a35

Please sign in to comment.