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:
commit
8e75da8540
|
@ -1222,6 +1222,7 @@ export default {
|
||||||
console.log("Received channel password lock change: ", state,
|
console.log("Received channel password lock change: ", state,
|
||||||
error);
|
error);
|
||||||
APP.UI.markRoomLocked(state);
|
APP.UI.markRoomLocked(state);
|
||||||
|
roomLocker.lockedElsewhere = state;
|
||||||
});
|
});
|
||||||
|
|
||||||
room.on(ConferenceEvents.USER_STATUS_CHANGED, function (id, status) {
|
room.on(ConferenceEvents.USER_STATUS_CHANGED, function (id, status) {
|
||||||
|
|
|
@ -116,6 +116,13 @@ export default function createRoomLocker (room) {
|
||||||
let password;
|
let password;
|
||||||
let dialog = null;
|
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) {
|
function lock (newPass) {
|
||||||
return room.lock(newPass).then(function () {
|
return room.lock(newPass).then(function () {
|
||||||
password = newPass;
|
password = newPass;
|
||||||
|
@ -135,13 +142,30 @@ export default function createRoomLocker (room) {
|
||||||
*/
|
*/
|
||||||
return {
|
return {
|
||||||
get isLocked () {
|
get isLocked () {
|
||||||
return !!password;
|
return !!password || lockedElsewhere;
|
||||||
},
|
},
|
||||||
|
|
||||||
get password () {
|
get password () {
|
||||||
return 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).
|
* Allows to remove password from the conference (asks user first).
|
||||||
* @returns {Promise}
|
* @returns {Promise}
|
||||||
|
@ -206,7 +230,7 @@ export default function createRoomLocker (room) {
|
||||||
dialog = null;
|
dialog = null;
|
||||||
};
|
};
|
||||||
|
|
||||||
if (password) {
|
if (this.isLocked) {
|
||||||
dialog = APP.UI.messageHandler
|
dialog = APP.UI.messageHandler
|
||||||
.openMessageDialog(null, "dialog.passwordError",
|
.openMessageDialog(null, "dialog.passwordError",
|
||||||
null, null, closeCallback);
|
null, null, closeCallback);
|
||||||
|
|
Loading…
Reference in New Issue