Преглед изворни кода

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

+ 26
- 2
modules/UI/authentication/RoomLocker.js Прегледај датотеку

116
     let password;
116
     let password;
117
     let dialog = null;
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
     function lock (newPass) {
126
     function lock (newPass) {
120
         return room.lock(newPass).then(function () {
127
         return room.lock(newPass).then(function () {
121
             password = newPass;
128
             password = newPass;
135
      */
142
      */
136
     return {
143
     return {
137
         get isLocked () {
144
         get isLocked () {
138
-            return !!password;
145
+            return !!password || lockedElsewhere;
139
         },
146
         },
140
 
147
 
141
         get password () {
148
         get password () {
142
             return password;
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
          * Allows to remove password from the conference (asks user first).
170
          * Allows to remove password from the conference (asks user first).
147
          * @returns {Promise}
171
          * @returns {Promise}
206
                 dialog = null;
230
                 dialog = null;
207
             };
231
             };
208
 
232
 
209
-            if (password) {
233
+            if (this.isLocked) {
210
                 dialog = APP.UI.messageHandler
234
                 dialog = APP.UI.messageHandler
211
                     .openMessageDialog(null, "dialog.passwordError",
235
                     .openMessageDialog(null, "dialog.passwordError",
212
                         null, null, closeCallback);
236
                         null, null, closeCallback);

Loading…
Откажи
Сачувај