Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.
TypeScript debiandeep-videojitsijitsi-meetscalable-video-conferencessfuvideovideo-communicationvideo-conferencingwebrtc
Handle Promise.reject for user cancel case
yanas0cf291d79635
diff --git a/modules/UI/authentication/RoomLocker.js b/modules/UI/authentication/RoomLocker.jsindex 6f083483f2..703cba4e51 100644--- a/modules/UI/authentication/RoomLocker.js+++ b/modules/UI/authentication/RoomLocker.js@@ -25,8 +25,9 @@ function askForNewPassword () {function (e, v, m, f) {if (v && f.lockKey) {resolve(UIUtil.escapeHtml(f.lockKey));- } else {- reject();+ }+ else {+ reject(messageHandler.CANCEL);}},null, null, 'input:first'@@ -58,7 +59,7 @@ function askForPassword () {if (v && f.lockKey) {resolve(UIUtil.escapeHtml(f.lockKey));} else {- reject();+ reject(messageHandler.CANCEL);}},':input:first'@@ -79,7 +80,7 @@ function askToUnlock () {if (v) {resolve();} else {- reject();+ reject(messageHandler.CANCEL);}});@@ -146,11 +147,16 @@ export default function createRoomLocker (room) {* @returns {Promise}*/askToUnlock () {- return askToUnlock().then(function () {- return lock();- }).then(function () {+ return askToUnlock().then(+ () => { return lock(); }+ ).then(function () {AnalyticsAdapter.sendEvent('toolbar.lock.disabled');- });+ }).catch(+ reason => {+ if (reason !== messageHandler.CANCEL)+ console.error(reason);+ }+ );},/**@@ -159,20 +165,30 @@ export default function createRoomLocker (room) {* @returns {Promise}*/askToLock () {- return askForNewPassword().then(function (newPass) {- return lock(newPass);- }).then(function () {+ return askForNewPassword().then(+ newPass => { return lock(newPass);}+ ).then(function () {AnalyticsAdapter.sendEvent('toolbar.lock.enabled');- });+ }).catch(+ reason => {+ if (reason !== messageHandler.CANCEL)+ console.error(reason);+ }+ );},/*** Asks user for required conference password.*/requirePassword () {- return askForPassword().then(function (newPass) {- password = newPass;- });+ return askForPassword().then(+ newPass => { password = newPass; }+ ).catch(+ reason => {+ if (reason !== messageHandler.CANCEL)+ console.error(reason);+ }+ );},/**diff --git a/modules/UI/recording/Recording.js b/modules/UI/recording/Recording.jsindex 1d5f75f3f6..051aeda1a8 100644--- a/modules/UI/recording/Recording.js+++ b/modules/UI/recording/Recording.js@@ -78,7 +78,7 @@ function _requestLiveStreamId() {return false;}} else {- reject();+ reject(APP.UI.messageHandler.CANCEL);dialog.close();return false;}@@ -97,7 +97,7 @@ function _requestLiveStreamId() {submit: function (e, v, m, f) {e.preventDefault();if (v === 0) {- reject();+ reject(APP.UI.messageHandler.CANCEL);dialog.close();} else {dialog.goToState('state0');@@ -128,7 +128,7 @@ function _requestRecordingToken () {if (v && f.recordingToken) {resolve(UIUtil.escapeHtml(f.recordingToken));} else {- reject();+ reject(APP.UI.messageHandler.CANCEL);}},null,@@ -282,7 +282,12 @@ var Recording = {_requestLiveStreamId().then((streamId) => {self.eventEmitter.emit( UIEvents.RECORDING_TOGGLED,{streamId: streamId});- });+ }).catch(+ reason => {+ if (reason !== APP.UI.messageHandler.CANCEL)+ console.error(reason);+ }+ );else {if (self.predefinedToken) {self.eventEmitter.emit( UIEvents.RECORDING_TOGGLED,@@ -293,7 +298,12 @@ var Recording = {_requestRecordingToken().then((token) => {self.eventEmitter.emit( UIEvents.RECORDING_TOGGLED,{token: token});- });+ }).catch(+ reason => {+ if (reason !== APP.UI.messageHandler.CANCEL)+ console.error(reason);+ }+ );}break;}diff --git a/modules/UI/util/MessageHandler.js b/modules/UI/util/MessageHandler.jsindex 0130b10c0f..3cbebc5a66 100644--- a/modules/UI/util/MessageHandler.js+++ b/modules/UI/util/MessageHandler.js@@ -10,7 +10,8 @@ import UIUtil from './UIUtil';var notificationsEnabled = true;var messageHandler = (function(my) {-+ my.OK = "dialog.OK",+ my.CANCEL = "dialog.Cancel",/*** Shows a message to the user.*