Skip to content

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

fix(feedback): Fixes the logic for the thank you dialog

hristoterezov3022754f19cd
diff --git a/conference.js b/conference.js
index cd2eef4c25..f617d16cb3 100644
--- a/conference.js
+++ b/conference.js
@@ -1748,8 +1748,11 @@ export default {
hangup (requestFeedback = false) {
APP.UI.hideRingOverLay();
let requestFeedbackPromise = requestFeedback
- ? APP.UI.requestFeedback().catch(() => Promise.resolve())
- : Promise.resolve();
+ ? APP.UI.requestFeedbackOnHangup()
+ // false - because the thank you dialog shouldn't be displayed
+ .catch(() => Promise.resolve(false))
+ : Promise.resolve(true);// true - because the thank you dialog
+ //should be displayed
// All promises are returning Promise.resolve to make Promise.all to
// be resolved when both Promises are finished. Otherwise Promise.all
// will reject on first rejected Promise and we can redirect the page
@@ -1757,9 +1760,9 @@ export default {
Promise.all([
requestFeedbackPromise,
room.leave().then(disconnect, disconnect)
- ]).then(() => {
+ ]).then(values => {
APP.API.notifyReadyToClose();
- maybeRedirectToWelcomePage();
+ maybeRedirectToWelcomePage(values[0]);
});
}
};
diff --git a/modules/UI/UI.js b/modules/UI/UI.js
index a8f542d017..2f005197be 100644
--- a/modules/UI/UI.js
+++ b/modules/UI/UI.js
@@ -1061,15 +1061,20 @@ UI.updateDTMFSupport = function (isDTMFSupported) {
};
/**
- * Show user feedback dialog if its required or just show "thank you" dialog.
- * @returns {Promise} when dialog is closed.
- */
-UI.requestFeedback = function () {
+ * Show user feedback dialog if its required and enabled after pressing the
+ * hangup button.
+ * @returns {Promise} Resolved with value - false if the dialog is enabled and
+ * resolved with true if the dialog is disabled or the feedback was already
+ * submitted. Rejected if another dialog is already displayed. This values are
+ * used to display or not display the thank you dialog from
+ * conference.maybeRedirectToWelcomePage method.
+ */
+UI.requestFeedbackOnHangup = function () {
if (Feedback.isVisible())
return Promise.reject(UIErrors.FEEDBACK_REQUEST_IN_PROGRESS);
// Feedback has been submitted already.
else if (Feedback.isEnabled() && Feedback.isSubmitted())
- return Promise.resolve();
+ return Promise.resolve(true);
else
return new Promise(function (resolve) {
if (Feedback.isEnabled()) {
@@ -1077,10 +1082,10 @@ UI.requestFeedback = function () {
// window and immidiately start the conference dispose timeout.
if (Feedback.getFeedbackScore() > 0) {
Feedback.openFeedbackWindow();
- resolve();
+ resolve(false);
} else { // Otherwise we'll wait for user's feedback.
- Feedback.openFeedbackWindow(resolve);
+ Feedback.openFeedbackWindow(() => resolve(false));
}
} else {
// If the feedback functionality isn't enabled we show a thank