Browse Source

Avoids multiple dialog when showing lock attempt errors.

master
damencho 9 years ago
parent
commit
7aa47647f0
1 changed files with 14 additions and 4 deletions
  1. 14
    4
      modules/UI/authentication/RoomLocker.js

+ 14
- 4
modules/UI/authentication/RoomLocker.js View File

116
  */
116
  */
117
 export default function createRoomLocker (room) {
117
 export default function createRoomLocker (room) {
118
     let password;
118
     let password;
119
+    let dialog = null;
119
 
120
 
120
     function lock (newPass) {
121
     function lock (newPass) {
121
         return room.lock(newPass).then(function () {
122
         return room.lock(newPass).then(function () {
196
          * Show notification that to set/remove password user must be moderator.
197
          * Show notification that to set/remove password user must be moderator.
197
          */
198
          */
198
         notifyModeratorRequired () {
199
         notifyModeratorRequired () {
200
+            if (dialog)
201
+                return;
202
+
203
+            let closeCallback = function () {
204
+                dialog = null;
205
+            };
206
+
199
             if (password) {
207
             if (password) {
200
-                APP.UI.messageHandler
201
-                    .openMessageDialog(null, "dialog.passwordError");
208
+                dialog = APP.UI.messageHandler
209
+                    .openMessageDialog(null, "dialog.passwordError",
210
+                        null, null, closeCallback);
202
             } else {
211
             } else {
203
-                APP.UI.messageHandler
204
-                    .openMessageDialog(null, "dialog.passwordError2");
212
+                dialog = APP.UI.messageHandler
213
+                    .openMessageDialog(null, "dialog.passwordError2",
214
+                        null, null, closeCallback);
205
             }
215
             }
206
         }
216
         }
207
     };
217
     };

Loading…
Cancel
Save