Merge pull request #1092 from jitsi/update-lock-state

Updates lock state
This commit is contained in:
yanas 2016-10-31 17:29:11 -05:00 committed by GitHub
commit a5e7c86125
2 changed files with 12 additions and 10 deletions

View File

@ -40,9 +40,9 @@ class Invite {
this.conference.on(ConferenceEvents.USER_ROLE_CHANGED, (id) => { this.conference.on(ConferenceEvents.USER_ROLE_CHANGED, (id) => {
if (APP.conference.isLocalId(id) if (APP.conference.isLocalId(id)
&& this.isModerator !== this.conference.isModerator) { && this.isModerator !== this.conference.isModerator()) {
this.setModerator(this.conference.isModerator); this.setModerator(this.conference.isModerator());
} }
}); });
@ -116,7 +116,6 @@ class Invite {
* creating view object using as a model this module * creating view object using as a model this module
*/ */
initDialog() { initDialog() {
this.password = this.getPassword();
this.view = new InviteDialogView(this); this.view = new InviteDialogView(this);
} }
@ -191,10 +190,8 @@ class Invite {
* @param isLocked * @param isLocked
*/ */
setLockedFromElsewhere(isLocked) { setLockedFromElsewhere(isLocked) {
// isLocked can be 1, true or false
let newLockState = (isLocked === 1) || isLocked;
let oldLockState = this.roomLocker.isLocked; let oldLockState = this.roomLocker.isLocked;
if (oldLockState !== newLockState) { if (oldLockState !== isLocked) {
this.roomLocker.lockedElsewhere = isLocked; this.roomLocker.lockedElsewhere = isLocked;
APP.UI.emitEvent(UIEvents.TOGGLE_ROOM_LOCK); APP.UI.emitEvent(UIEvents.TOGGLE_ROOM_LOCK);
this.updateView(); this.updateView();

View File

@ -177,7 +177,8 @@ export default class InviteDialogView {
* @returns {string} * @returns {string}
*/ */
getPasswordBlock() { getPasswordBlock() {
let { password, isModerator } = this.model; let password = this.model.getPassword();
let { isModerator } = this.model;
if (isModerator) { if (isModerator) {
return (` return (`
@ -321,13 +322,17 @@ export default class InviteDialogView {
*/ */
updateView() { updateView() {
let pass = this.model.getPassword(); let pass = this.model.getPassword();
if (this.model.getRoomLocker().lockedElsewhere || !pass) let { isModerator } = this.model;
if (this.model.getRoomLocker().lockedElsewhere || !pass) {
$('#inviteDialogPassword').attr("data-i18n", "passwordSetRemotely"); $('#inviteDialogPassword').attr("data-i18n", "passwordSetRemotely");
else APP.translation.translateElement($('#inviteDialogPassword'));
} else {
$('#inviteDialogPassword').removeAttr("data-i18n");
$('#inviteDialogPassword').text(pass); $('#inviteDialogPassword').text(pass);
}
// if we are not moderator we cannot remove password // if we are not moderator we cannot remove password
if (APP.conference.isModerator) if (isModerator)
$('#inviteDialogRemovePassword').show(); $('#inviteDialogRemovePassword').show();
else else
$('#inviteDialogRemovePassword').hide(); $('#inviteDialogRemovePassword').hide();