fix(feedback): Fixes the logic for the thank you dialog
This commit is contained in:
parent
63dfa5247f
commit
3022754f19
|
@ -1748,8 +1748,11 @@ export default {
|
||||||
hangup (requestFeedback = false) {
|
hangup (requestFeedback = false) {
|
||||||
APP.UI.hideRingOverLay();
|
APP.UI.hideRingOverLay();
|
||||||
let requestFeedbackPromise = requestFeedback
|
let requestFeedbackPromise = requestFeedback
|
||||||
? APP.UI.requestFeedback().catch(() => Promise.resolve())
|
? APP.UI.requestFeedbackOnHangup()
|
||||||
: Promise.resolve();
|
// 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
|
// All promises are returning Promise.resolve to make Promise.all to
|
||||||
// be resolved when both Promises are finished. Otherwise Promise.all
|
// be resolved when both Promises are finished. Otherwise Promise.all
|
||||||
// will reject on first rejected Promise and we can redirect the page
|
// will reject on first rejected Promise and we can redirect the page
|
||||||
|
@ -1757,9 +1760,9 @@ export default {
|
||||||
Promise.all([
|
Promise.all([
|
||||||
requestFeedbackPromise,
|
requestFeedbackPromise,
|
||||||
room.leave().then(disconnect, disconnect)
|
room.leave().then(disconnect, disconnect)
|
||||||
]).then(() => {
|
]).then(values => {
|
||||||
APP.API.notifyReadyToClose();
|
APP.API.notifyReadyToClose();
|
||||||
maybeRedirectToWelcomePage();
|
maybeRedirectToWelcomePage(values[0]);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -1061,15 +1061,20 @@ UI.updateDTMFSupport = function (isDTMFSupported) {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show user feedback dialog if its required or just show "thank you" dialog.
|
* Show user feedback dialog if its required and enabled after pressing the
|
||||||
* @returns {Promise} when dialog is closed.
|
* 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.requestFeedback = function () {
|
UI.requestFeedbackOnHangup = function () {
|
||||||
if (Feedback.isVisible())
|
if (Feedback.isVisible())
|
||||||
return Promise.reject(UIErrors.FEEDBACK_REQUEST_IN_PROGRESS);
|
return Promise.reject(UIErrors.FEEDBACK_REQUEST_IN_PROGRESS);
|
||||||
// Feedback has been submitted already.
|
// Feedback has been submitted already.
|
||||||
else if (Feedback.isEnabled() && Feedback.isSubmitted())
|
else if (Feedback.isEnabled() && Feedback.isSubmitted())
|
||||||
return Promise.resolve();
|
return Promise.resolve(true);
|
||||||
else
|
else
|
||||||
return new Promise(function (resolve) {
|
return new Promise(function (resolve) {
|
||||||
if (Feedback.isEnabled()) {
|
if (Feedback.isEnabled()) {
|
||||||
|
@ -1077,10 +1082,10 @@ UI.requestFeedback = function () {
|
||||||
// window and immidiately start the conference dispose timeout.
|
// window and immidiately start the conference dispose timeout.
|
||||||
if (Feedback.getFeedbackScore() > 0) {
|
if (Feedback.getFeedbackScore() > 0) {
|
||||||
Feedback.openFeedbackWindow();
|
Feedback.openFeedbackWindow();
|
||||||
resolve();
|
resolve(false);
|
||||||
|
|
||||||
} else { // Otherwise we'll wait for user's feedback.
|
} else { // Otherwise we'll wait for user's feedback.
|
||||||
Feedback.openFeedbackWindow(resolve);
|
Feedback.openFeedbackWindow(() => resolve(false));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// If the feedback functionality isn't enabled we show a thank
|
// If the feedback functionality isn't enabled we show a thank
|
||||||
|
|
Loading…
Reference in New Issue