Merge pull request #926 from jitsi/lock-fixes

Changes the state of room locker if room was locked not by current user.
This commit is contained in:
yanas 2016-09-23 11:51:42 -05:00 committed by GitHub
commit 8e75da8540
2 changed files with 27 additions and 2 deletions

View File

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

View File

@ -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);