Skip to content

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

Fixes hangup triggering several times

yanas2bb637e14005
diff --git a/conference.js b/conference.js
index 8f9b6584ea..5ffe279338 100644
--- a/conference.js
+++ b/conference.js
@@ -37,6 +37,12 @@ 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";
/**
@@ -232,6 +238,13 @@ 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();
@@ -242,6 +255,8 @@ function hangup (requestFeedback = false) {
.catch(errCallback.bind(null, disconnect))
.then(maybeRedirectToWelcomePage)
.catch(errCallback.bind(null, maybeRedirectToWelcomePage));
+
+ _hangupInProgress = false;
}
/**
diff --git a/modules/UI/Feedback.js b/modules/UI/Feedback.js
index 5799bd8b73..39d7f682f7 100644
--- a/modules/UI/Feedback.js
+++ b/modules/UI/Feedback.js
@@ -134,6 +134,17 @@ var Feedback = {
isEnabled: function() {
return this.enabled && APP.conference.isCallstatsEnabled();
},
+
+ /**
+ * Returns true if the feedback window is currently visible and false
+ * otherwise.
+ * @return {boolean} true if the feedback window is visible, false
+ * otherwise
+ */
+ isVisible: function() {
+ return $(".feedback").is(":visible");
+ },
+
/**
* Opens the feedback window.
*/
diff --git a/modules/UI/UI.js b/modules/UI/UI.js
index e57fe22516..ec4fc786e1 100644
--- a/modules/UI/UI.js
+++ b/modules/UI/UI.js
@@ -1063,29 +1063,32 @@ UI.inviteParticipants = function (roomUrl, conferenceName, key, nick) {
* @returns {Promise} when dialog is closed.
*/
UI.requestFeedback = function () {
- return new Promise(function (resolve, reject) {
- if (Feedback.isEnabled()) {
- // If the user has already entered feedback, we'll show the window and
- // immidiately start the conference dispose timeout.
- if (Feedback.feedbackScore > 0) {
- Feedback.openFeedbackWindow();
+ if (Feedback.isVisible())
+ return Promise.resolve();
+ else
+ return new Promise(function (resolve, reject) {
+ if (Feedback.isEnabled()) {
+ // If the user has already entered feedback, we'll show the
+ // window and immidiately start the conference dispose timeout.
+ if (Feedback.feedbackScore > 0) {
+ Feedback.openFeedbackWindow();
+ resolve();
+
+ } else { // Otherwise we'll wait for user's feedback.
+ Feedback.openFeedbackWindow(resolve);
+ }
+ } else {
+ // If the feedback functionality isn't enabled we show a thank
+ // you dialog.
+ messageHandler.openMessageDialog(
+ null, null, null,
+ APP.translation.translateString(
+ "dialog.thankYou", {appName:interfaceConfig.APP_NAME}
+ )
+ );
resolve();
-
- } else { // Otherwise we'll wait for user's feedback.
- Feedback.openFeedbackWindow(resolve);
}
- } else {
- // If the feedback functionality isn't enabled we show a thank you
- // dialog.
- messageHandler.openMessageDialog(
- null, null, null,
- APP.translation.translateString(
- "dialog.thankYou", {appName:interfaceConfig.APP_NAME}
- )
- );
- resolve();
- }
- });
+ });
};
UI.updateRecordingState = function (state) {