Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

Got rid of direct usage of room locker

Ilya Daynatovichd4df6f2ddadc
diff --git a/modules/UI/invite/AskForPassword.js b/modules/UI/invite/AskForPassword.js
deleted file mode 100644
index 77a27ddf43..0000000000
--- a/modules/UI/invite/AskForPassword.js
+++ /dev/null
@@ -1,31 +0,0 @@
-/* global APP, $ */
-
-import UIUtil from '../util/UIUtil';
-
-/**
- * Show dialog which asks for required conference password.
- * @returns {Promise<string>} password or nothing if user canceled
- */
-export default function askForPassword () {
- let titleKey = "dialog.passwordRequired";
- let msgString = `
- <input name="lockKey" type="text"
- data-i18n="[placeholder]dialog.password"
- autofocus>`;
- return new Promise(function (resolve, reject) {
- APP.UI.messageHandler.openTwoButtonDialog({
- titleKey,
- msgString,
- leftButtonKey: "dialog.Ok",
- submitFunction: $.noop,
- closeFunction: function (e, v, m, f) {
- if (v && f.lockKey) {
- resolve(UIUtil.escapeHtml(f.lockKey));
- } else {
- reject(APP.UI.messageHandler.CANCEL);
- }
- },
- focus: ':input:first'
- });
- });
-}
\ No newline at end of file
diff --git a/modules/UI/invite/Invite.js b/modules/UI/invite/Invite.js
index 737ed673b4..7cc821e014 100644
--- a/modules/UI/invite/Invite.js
+++ b/modules/UI/invite/Invite.js
@@ -32,7 +32,7 @@ class Invite {
error);
if (!locked) {
- this.roomLocker.resetPassword();
+ this.getRoomLocker().resetPassword();
}
this.setLockedFromElsewhere(locked);
@@ -56,9 +56,10 @@ class Invite {
APP.UI.addListener( UIEvents.PASSWORD_REQUIRED,
() => {
+ let roomLocker = this.getRoomLocker();
this.setLockedFromElsewhere(true);
- this.roomLocker.requirePassword().then(() => {
- let pass = this.roomLocker.password;
+ roomLocker.requirePassword().then(() => {
+ let pass = roomLocker.password;
// we received that password is required, but user is trying
// anyway to login without a password, mark room as not
// locked in case he succeeds (maybe someone removed the
@@ -67,7 +68,7 @@ class Invite {
// will be marked as locked.
if (!pass)
this.setLockedFromElsewhere(false);
- this.conference.join(this.roomLocker.password);
+ this.conference.join(roomLocker.password);
});
});
}
@@ -129,7 +130,7 @@ class Invite {
* @returns {String} password
*/
getPassword() {
- return this.roomLocker.password;
+ return this.getRoomLocker().password;
}
/**
@@ -149,7 +150,7 @@ class Invite {
*/
setRoomUnlocked() {
if (this.isModerator) {
- this.roomLocker.lock().then(() => {
+ this.getRoomLocker().lock().then(() => {
APP.UI.emitEvent(UIEvents.TOGGLE_ROOM_LOCK);
this.updateView();
});
@@ -164,8 +165,8 @@ class Invite {
*/
setRoomLocked(newPass) {
let isModerator = this.isModerator;
- if (isModerator && (newPass || !this.roomLocker.isLocked)) {
- this.roomLocker.lock(newPass).then(() => {
+ if (isModerator && (newPass || !this.getRoomLocker().isLocked)) {
+ this.getRoomLocker().lock(newPass).then(() => {
APP.UI.emitEvent(UIEvents.TOGGLE_ROOM_LOCK);
this.updateView();
});
@@ -187,7 +188,7 @@ class Invite {
* @returns {Boolean} isLocked
*/
isLocked() {
- return this.roomLocker.isLocked;
+ return this.getRoomLocker().isLocked;
}
/**
@@ -195,9 +196,10 @@ class Invite {
* @param isLocked
*/
setLockedFromElsewhere(isLocked) {
- let oldLockState = this.roomLocker.isLocked;
+ let roomLocker = this.getRoomLocker();
+ let oldLockState = roomLocker.isLocked;
if (oldLockState !== isLocked) {
- this.roomLocker.lockedElsewhere = isLocked;
+ roomLocker.lockedElsewhere = isLocked;
APP.UI.emitEvent(UIEvents.TOGGLE_ROOM_LOCK);
this.updateView();
}
diff --git a/modules/UI/invite/RequirePasswordDialog.js b/modules/UI/invite/RequirePasswordDialog.js
index a5e80cd48b..d8a71cd342 100644
--- a/modules/UI/invite/RequirePasswordDialog.js
+++ b/modules/UI/invite/RequirePasswordDialog.js
@@ -23,19 +23,16 @@ export default class RequirePasswordDialog {
}
_getBodyMessage() {
- let passMsg = APP.translation.translateString("dialog.password");
- let label = APP.translation.translateString(this.labelKey);
- let error = APP.translation.translateString(this.errorKey);
return (
`<div class="input-control">
<label class="input-control__label"
- data-i18n="${this.labelKey}">${label}</label>
+ data-i18n="${this.labelKey}"></label>
<input class="input-control__input" name="lockKey" type="text"
data-i18n="[placeholder]dialog.password"
- placeholder="${passMsg}" autofocus id="${this.inputId}">
+ autofocus id="${this.inputId}">
<p class="input-control__hint input-control__hint_error hide"
id="${this.errorId}"
- data-i18n="${this.errorKey}">${error}</p>
+ data-i18n="${this.errorKey}"></p>
</div>`
);
}