Fixes password and isModerator check in invite dialog.

This commit is contained in:
damencho 2016-10-31 14:01:22 -05:00
parent 1036768b2a
commit 96479e0474
2 changed files with 7 additions and 8 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,14 @@ export default class InviteDialogView {
*/ */
updateView() { updateView() {
let pass = this.model.getPassword(); let pass = this.model.getPassword();
let { isModerator } = this.model;
if (this.model.getRoomLocker().lockedElsewhere || !pass) if (this.model.getRoomLocker().lockedElsewhere || !pass)
$('#inviteDialogPassword').attr("data-i18n", "passwordSetRemotely"); $('#inviteDialogPassword').attr("data-i18n", "passwordSetRemotely");
else else
$('#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();