From 5feeef0122984175e04f79c2429e8f8dab0b33d8 Mon Sep 17 00:00:00 2001 From: damencho Date: Tue, 1 Nov 2016 13:14:21 -0500 Subject: [PATCH] Handles data from feedback callback and use it for correct close page. --- conference.js | 30 +++++++++++++++++------------- modules/UI/UI.js | 24 ++++++++++++------------ 2 files changed, 29 insertions(+), 25 deletions(-) diff --git a/conference.js b/conference.js index b10f6c556..484497495 100644 --- a/conference.js +++ b/conference.js @@ -184,29 +184,33 @@ function muteLocalVideo (muted) { * If requested show a thank you dialog before that. * If we have a close page enabled, redirect to it without * showing any other dialog. - * @param {boolean} showThankYou whether we should show a thank you dialog + * + * @param {object} data Feedback data + * @param {boolean} data.showThankYou - whether we should show thank you dialog + * @param {boolean} data.feedbackSubmitted - whether feedback was submitted */ -function maybeRedirectToWelcomePage(showThankYou) { - +function maybeRedirectToWelcomePage(data) { // if close page is enabled redirect to it, without further action if (config.enableClosePage) { - window.location.pathname = "close.html"; + if (data.feedbackSubmitted) + window.location.pathname = "close.html"; + else + window.location.pathname = "close2.html"; return; } - if (showThankYou) { + // else: show thankYou dialog only if there is no feedback + if (data.showThankYou) APP.UI.messageHandler.openMessageDialog( null, "dialog.thankYou", {appName:interfaceConfig.APP_NAME}); - } - if (!config.enableWelcomePage) { - return; + // if Welcome page is enabled redirect to welcome page after 3 sec. + if (config.enableWelcomePage) { + setTimeout(() => { + APP.settings.setWelcomePageEnabled(true); + window.location.pathname = "/"; + }, 3000); } - // redirect to welcome page - setTimeout(() => { - APP.settings.setWelcomePageEnabled(true); - window.location.pathname = "/"; - }, 3000); } /** diff --git a/modules/UI/UI.js b/modules/UI/UI.js index f4cb07285..b33356d7e 100644 --- a/modules/UI/UI.js +++ b/modules/UI/UI.js @@ -1037,25 +1037,25 @@ 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(true); + else if (Feedback.isEnabled() && Feedback.isSubmitted()) { + return Promise.resolve({ + showThankYou : true, + feedbackSubmitted: true + }); + } else return new Promise(function (resolve) { if (Feedback.isEnabled()) { - // If the user has already entered feedback, we'll show the - // window and immidiately start the conference dispose timeout. - if (Feedback.getFeedbackScore() > 0) { - Feedback.openFeedbackWindow(); - resolve(false); - - } else { // Otherwise we'll wait for user's feedback. - Feedback.openFeedbackWindow(() => resolve(false)); - } + Feedback.openFeedbackWindow( + (data) => { + data.showThankYou = false; + resolve(data); + }); } else { // If the feedback functionality isn't enabled we show a thank // you dialog. Signaling it (true), so the caller // of requestFeedback can act on it - resolve(true); + resolve({showThankYou : true, feedbackSubmitted: false}); } }); };