Переглянути джерело

Merge pull request #926 from jitsi/lock-fixes

Changes the state of room locker if room was locked not by current user.
j8
yanas 9 роки тому
джерело
коміт
8e75da8540
2 змінених файлів з 27 додано та 2 видалено
  1. 1
    0
      conference.js
  2. 26
    2
      modules/UI/authentication/RoomLocker.js

+ 1
- 0
conference.js Переглянути файл

@@ -1222,6 +1222,7 @@ export default {
1222 1222
             console.log("Received channel password lock change: ", state,
1223 1223
                 error);
1224 1224
             APP.UI.markRoomLocked(state);
1225
+            roomLocker.lockedElsewhere = state;
1225 1226
         });
1226 1227
 
1227 1228
         room.on(ConferenceEvents.USER_STATUS_CHANGED, function (id, status) {

+ 26
- 2
modules/UI/authentication/RoomLocker.js Переглянути файл

@@ -116,6 +116,13 @@ export default function createRoomLocker (room) {
116 116
     let password;
117 117
     let dialog = null;
118 118
 
119
+    /**
120
+     * If the room was locked from someone other than us, we indicate it with
121
+     * this property in order to have correct roomLocker state of isLocked.
122
+     * @type {boolean} whether room is locked, but not from us.
123
+     */
124
+    let lockedElsewhere = false;
125
+
119 126
     function lock (newPass) {
120 127
         return room.lock(newPass).then(function () {
121 128
             password = newPass;
@@ -135,13 +142,30 @@ export default function createRoomLocker (room) {
135 142
      */
136 143
     return {
137 144
         get isLocked () {
138
-            return !!password;
145
+            return !!password || lockedElsewhere;
139 146
         },
140 147
 
141 148
         get password () {
142 149
             return password;
143 150
         },
144 151
 
152
+        /**
153
+         * Sets that the room is locked from another user, not us.
154
+         * @param {boolean} value locked/unlocked state
155
+         */
156
+        set lockedElsewhere (value) {
157
+            lockedElsewhere = value;
158
+        },
159
+
160
+        /**
161
+         * Whether room is locked from someone else.
162
+         * @returns {boolean} whether room is not locked locally,
163
+         * but it is still locked.
164
+         */
165
+        get lockedElsewhere () {
166
+            return lockedElsewhere;
167
+        },
168
+
145 169
         /**
146 170
          * Allows to remove password from the conference (asks user first).
147 171
          * @returns {Promise}
@@ -206,7 +230,7 @@ export default function createRoomLocker (room) {
206 230
                 dialog = null;
207 231
             };
208 232
 
209
-            if (password) {
233
+            if (this.isLocked) {
210 234
                 dialog = APP.UI.messageHandler
211 235
                     .openMessageDialog(null, "dialog.passwordError",
212 236
                         null, null, closeCallback);

Завантаження…
Відмінити
Зберегти