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
Fixes hangup triggering multiple feedbacks.
yanas777217bd7559
diff --git a/conference.js b/conference.jsindex 5ffe279338..40a2d217a4 100644--- a/conference.js+++ b/conference.js@@ -16,6 +16,8 @@ import mediaDeviceHelper from './modules/devices/mediaDeviceHelper';import {reportError} from './modules/util/helpers';+import Feedback from './modules/UI/Feedback';+const ConnectionEvents = JitsiMeetJS.events.connection;const ConnectionErrors = JitsiMeetJS.errors.connection;@@ -37,12 +39,6 @@ let connectionIsInterrupted = false;*/let DSExternalInstallationInProgress = false;-/**- * Indicates whether we have started a hangup process.- * @type {boolean}- */-let _hangupInProgress = false;-import {VIDEO_CONTAINER_TYPE} from "./modules/UI/videolayout/LargeVideo";/**@@ -238,25 +234,29 @@ function disconnectAndShowFeedback(requestFeedback) {* @param {boolean} [requestFeedback=false] if user feedback should be requested*/function hangup (requestFeedback = false) {- if (_hangupInProgress) {- console.log("Hangup already in progress.");- return;- }-- _hangupInProgress = true;-const errCallback = (f, err) => {- console.error('Error occurred during hanging up: ', err);- return f();++ // If we want to break out the chain in our error handler, it needs+ // to return a rejected promise. In the case of feedback request+ // in progress it's important to not redirect to the welcome page+ // (see below maybeRedirectToWelcomePage call).+ if (err === Feedback.FEEDBACK_REQUEST_IN_PROGRESS) {+ return Promise.reject('Feedback request in progress.');+ }+ else {+ console.error('Error occurred during hanging up: ', err);+ return Promise.resolve();+ }};const disconnect = disconnectAndShowFeedback.bind(null, requestFeedback);APP.conference._room.leave().then(disconnect).catch(errCallback.bind(null, disconnect)).then(maybeRedirectToWelcomePage)- .catch(errCallback.bind(null, maybeRedirectToWelcomePage));+ .catch(function(err){+ console.log(err);+ });- _hangupInProgress = false;}/**diff --git a/modules/UI/Feedback.js b/modules/UI/Feedback.jsindex 39d7f682f7..c0795dbfec 100644--- a/modules/UI/Feedback.js+++ b/modules/UI/Feedback.js@@ -86,10 +86,16 @@ function _showFeedbackButton (show) {* toggleStars: Function, hoverStars: Function, unhoverStars: Function}}*/var Feedback = {+ /**+ * Indicates a state of the Feedback dialog.+ */+ FEEDBACK_REQUEST_IN_PROGRESS: "FeedbackRequestInProgress",+/*** The feedback score. -1 indicates no score has been given for now.*/feedbackScore: -1,+/*** Initialise the Feedback functionality.* @param emitter the EventEmitter to associate with the Feedback.diff --git a/modules/UI/UI.js b/modules/UI/UI.jsindex ec4fc786e1..99f1fa7cfd 100644--- a/modules/UI/UI.js+++ b/modules/UI/UI.js@@ -1064,7 +1064,7 @@ UI.inviteParticipants = function (roomUrl, conferenceName, key, nick) {*/UI.requestFeedback = function () {if (Feedback.isVisible())- return Promise.resolve();+ return Promise.reject(Feedback.FEEDBACK_REQUEST_IN_PROGRESS);elsereturn new Promise(function (resolve, reject) {if (Feedback.isEnabled()) {