Skip to content

Commit

Permalink
fixes #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 Apr 30, 2021
1 parent f9bcc98 commit 0ad44cd
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions changelog.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ <h1>

<p><b>4.5.0</b> -- tbd</p>
<ul>
<li>[<a href="https://github.com/igniterealtime/openfire-fastpath-plugin/issues/48">#48</a>] - Converse end-user UI does not get notified of rejection.</li>
<li>[<a href="https://github.com/igniterealtime/openfire-fastpath-plugin/issues/47">#47</a>] - Fix ChatBot's rejection message.</li>
<li>[<a href="https://github.com/igniterealtime/openfire-fastpath-plugin/issues/46">#46</a>] - Allow workgroup's chatbot to be configured in the admin console.</li>
<li>[<a href="https://github.com/igniterealtime/openfire-fastpath-plugin/issues/45">#45</a>] - Fix invalid roomconfig value: moderators (should be: moderator)</li>
Expand Down
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 0ad44cd

Please sign in to comment.