diff --git a/conference.js b/conference.js index b0edba985..f8896539f 100644 --- a/conference.js +++ b/conference.js @@ -1202,6 +1202,7 @@ export default { console.log("Received channel password lock change: ", state, error); APP.UI.markRoomLocked(state); + roomLocker.lockedElsewhere = true; }); room.on(ConferenceEvents.USER_STATUS_CHANGED, function (id, status) { diff --git a/modules/UI/authentication/RoomLocker.js b/modules/UI/authentication/RoomLocker.js index de08a4b53..4c05b6dce 100644 --- a/modules/UI/authentication/RoomLocker.js +++ b/modules/UI/authentication/RoomLocker.js @@ -116,6 +116,13 @@ export default function createRoomLocker (room) { let password; let dialog = null; + /** + * If the room was locked from someone other than us, we indicate it with + * this property in order to have correct roomLocker state of isLocked. + * @type {boolean} whether room is locked, but not from us. + */ + let lockedElsewhere = false; + function lock (newPass) { return room.lock(newPass).then(function () { password = newPass; @@ -135,13 +142,30 @@ export default function createRoomLocker (room) { */ return { get isLocked () { - return !!password; + return !!password || lockedElsewhere; }, get password () { return password; }, + /** + * Sets that the room is locked from another user, not us. + * @param {boolean} value locked/unlocked state + */ + set lockedElsewhere (value) { + lockedElsewhere = value; + }, + + /** + * Whether room is locked from someone else. + * @returns {boolean} whether room is not locked locally, + * but it is still locked. + */ + get lockedElsewhere () { + return lockedElsewhere; + }, + /** * Allows to remove password from the conference (asks user first). * @returns {Promise} @@ -206,7 +230,7 @@ export default function createRoomLocker (room) { dialog = null; }; - if (password) { + if (this.isLocked) { dialog = APP.UI.messageHandler .openMessageDialog(null, "dialog.passwordError", null, null, closeCallback);