Sfoglia il codice sorgente

Handles data from feedback callback and use it for correct close page.

master
damencho 8 anni fa
parent
commit
5feeef0122
2 ha cambiato i file con 29 aggiunte e 25 eliminazioni
  1. 17
    13
      conference.js
  2. 12
    12
      modules/UI/UI.js

+ 17
- 13
conference.js Vedi File

@@ -184,29 +184,33 @@ function muteLocalVideo (muted) {
184 184
  * If requested show a thank you dialog before that.
185 185
  * If we have a close page enabled, redirect to it without
186 186
  * showing any other dialog.
187
- * @param {boolean} showThankYou whether we should show a thank you dialog
187
+ *
188
+ * @param {object} data Feedback data
189
+ * @param {boolean} data.showThankYou - whether we should show thank you dialog
190
+ * @param {boolean} data.feedbackSubmitted - whether feedback was submitted
188 191
  */
189
-function maybeRedirectToWelcomePage(showThankYou) {
190
-
192
+function maybeRedirectToWelcomePage(data) {
191 193
     // if close page is enabled redirect to it, without further action
192 194
     if (config.enableClosePage) {
193
-        window.location.pathname = "close.html";
195
+        if (data.feedbackSubmitted)
196
+            window.location.pathname = "close.html";
197
+        else
198
+            window.location.pathname = "close2.html";
194 199
         return;
195 200
     }
196 201
 
197
-    if (showThankYou) {
202
+    // else: show thankYou dialog only if there is no feedback
203
+    if (data.showThankYou)
198 204
         APP.UI.messageHandler.openMessageDialog(
199 205
             null, "dialog.thankYou", {appName:interfaceConfig.APP_NAME});
200
-    }
201 206
 
202
-    if (!config.enableWelcomePage) {
203
-        return;
207
+    // if Welcome page is enabled redirect to welcome page after 3 sec.
208
+    if (config.enableWelcomePage) {
209
+        setTimeout(() => {
210
+            APP.settings.setWelcomePageEnabled(true);
211
+            window.location.pathname = "/";
212
+        }, 3000);
204 213
     }
205
-    // redirect to welcome page
206
-    setTimeout(() => {
207
-        APP.settings.setWelcomePageEnabled(true);
208
-        window.location.pathname = "/";
209
-    }, 3000);
210 214
 }
211 215
 
212 216
 /**

+ 12
- 12
modules/UI/UI.js Vedi File

@@ -1037,25 +1037,25 @@ UI.requestFeedbackOnHangup = function () {
1037 1037
     if (Feedback.isVisible())
1038 1038
         return Promise.reject(UIErrors.FEEDBACK_REQUEST_IN_PROGRESS);
1039 1039
     // Feedback has been submitted already.
1040
-    else if (Feedback.isEnabled() && Feedback.isSubmitted())
1041
-        return Promise.resolve(true);
1040
+    else if (Feedback.isEnabled() && Feedback.isSubmitted()) {
1041
+        return Promise.resolve({
1042
+            showThankYou : true,
1043
+            feedbackSubmitted: true
1044
+        });
1045
+    }
1042 1046
     else
1043 1047
         return new Promise(function (resolve) {
1044 1048
             if (Feedback.isEnabled()) {
1045
-                // If the user has already entered feedback, we'll show the
1046
-                // window and immidiately start the conference dispose timeout.
1047
-                if (Feedback.getFeedbackScore() > 0) {
1048
-                    Feedback.openFeedbackWindow();
1049
-                    resolve(false);
1050
-
1051
-                } else { // Otherwise we'll wait for user's feedback.
1052
-                    Feedback.openFeedbackWindow(() => resolve(false));
1053
-                }
1049
+                Feedback.openFeedbackWindow(
1050
+                    (data) => {
1051
+                        data.showThankYou = false;
1052
+                        resolve(data);
1053
+                    });
1054 1054
             } else {
1055 1055
                 // If the feedback functionality isn't enabled we show a thank
1056 1056
                 // you dialog. Signaling it (true), so the caller
1057 1057
                 // of requestFeedback can act on it
1058
-                resolve(true);
1058
+                resolve({showThankYou : true, feedbackSubmitted: false});
1059 1059
             }
1060 1060
         });
1061 1061
 };

Loading…
Annulla
Salva