Merge pull request #736 from jitsi/lock-error-dialog

Avoids multiple dialog when showing lock attempt errors.
This commit is contained in:
hristoterezov 2016-07-15 16:02:26 -05:00 committed by GitHub
commit 5b884806d2
1 changed files with 14 additions and 4 deletions

View File

@ -116,6 +116,7 @@ const ConferenceErrors = JitsiMeetJS.errors.conference;
*/ */
export default function createRoomLocker (room) { export default function createRoomLocker (room) {
let password; let password;
let dialog = null;
function lock (newPass) { function lock (newPass) {
return room.lock(newPass).then(function () { return room.lock(newPass).then(function () {
@ -196,12 +197,21 @@ export default function createRoomLocker (room) {
* Show notification that to set/remove password user must be moderator. * Show notification that to set/remove password user must be moderator.
*/ */
notifyModeratorRequired () { notifyModeratorRequired () {
if (dialog)
return;
let closeCallback = function () {
dialog = null;
};
if (password) { if (password) {
APP.UI.messageHandler dialog = APP.UI.messageHandler
.openMessageDialog(null, "dialog.passwordError"); .openMessageDialog(null, "dialog.passwordError",
null, null, closeCallback);
} else { } else {
APP.UI.messageHandler dialog = APP.UI.messageHandler
.openMessageDialog(null, "dialog.passwordError2"); .openMessageDialog(null, "dialog.passwordError2",
null, null, closeCallback);
} }
} }
}; };