Merge pull request #1049 from jitsi/fix_thank_you_dialog
fix(feedback): Fixes the logic for the thank you dialog
This commit is contained in:
commit
4b82bc0e33
|
@ -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]);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
|
@ -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.
|
||||
* 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.requestFeedback = function () {
|
||||
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
|
||||
|
|
Loading…
Reference in New Issue