From a55e3f5d9d88ce8af970881337976a89ad3822e7 Mon Sep 17 00:00:00 2001 From: Damian Minkov Date: Fri, 24 Oct 2014 16:33:48 +0300 Subject: [PATCH] Fixes issue with unable to open second dialog on wrong room key entered. Still tests to come. Handle dialog action after the dialog is closed, otherwise the event for wrong key can come before the dialog is closed and will not be open again. --- app.js | 7 ++++--- message_handler.js | 7 +++++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/app.js b/app.js index 86994b428..e22eeafc5 100644 --- a/app.js +++ b/app.js @@ -855,6 +855,10 @@ $(document).bind('passwordrequired.muc', function (event, jid) { '', true, "Ok", + function (e, v, m, f) {}, + function (event) { + document.getElementById('lockKey').focus(); + }, function (e, v, m, f) { if (v) { var lockKey = document.getElementById('lockKey'); @@ -863,9 +867,6 @@ $(document).bind('passwordrequired.muc', function (event, jid) { connection.emuc.doJoin(jid, lockKey.value); } } - }, - function (event) { - document.getElementById('lockKey').focus(); } ); }); diff --git a/message_handler.js b/message_handler.js index 0ab3b4deb..be980a3e3 100644 --- a/message_handler.js +++ b/message_handler.js @@ -24,8 +24,10 @@ var messageHandler = (function(my) { * @param leftButton the fist button's text * @param submitFunction function to be called on submit * @param loadedFunction function to be called after the prompt is fully loaded + * @param closeFunction function to be called after the prompt is closed */ - my.openTwoButtonDialog = function(titleString, msgString, persistent, leftButton, submitFunction, loadedFunction) { + my.openTwoButtonDialog = function(titleString, msgString, persistent, leftButton, + submitFunction, loadedFunction, closeFunction) { var buttons = {}; buttons[leftButton] = true; buttons.Cancel = false; @@ -35,7 +37,8 @@ var messageHandler = (function(my) { buttons: buttons, defaultButton: 1, loaded: loadedFunction, - submit: submitFunction + submit: submitFunction, + close: closeFunction }); };