ソースを参照

Merge pull request #1049 from jitsi/fix_thank_you_dialog

fix(feedback): Fixes the logic for the thank you dialog
j8
Дамян Минков 8年前
コミット
4b82bc0e33
2個のファイルの変更19行の追加11行の削除
  1. 7
    4
      conference.js
  2. 12
    7
      modules/UI/UI.js

+ 7
- 4
conference.js ファイルの表示

@@ -1748,8 +1748,11 @@ export default {
1748 1748
     hangup (requestFeedback = false) {
1749 1749
         APP.UI.hideRingOverLay();
1750 1750
         let requestFeedbackPromise = requestFeedback
1751
-                ? APP.UI.requestFeedback().catch(() => Promise.resolve())
1752
-                : Promise.resolve();
1751
+                ? APP.UI.requestFeedbackOnHangup()
1752
+                // false - because the thank you dialog shouldn't be displayed
1753
+                    .catch(() => Promise.resolve(false))
1754
+                : Promise.resolve(true);// true - because the thank you dialog
1755
+                //should be displayed
1753 1756
         // All promises are returning Promise.resolve to make Promise.all to
1754 1757
         // be resolved when both Promises are finished. Otherwise Promise.all
1755 1758
         // will reject on first rejected Promise and we can redirect the page
@@ -1757,9 +1760,9 @@ export default {
1757 1760
         Promise.all([
1758 1761
             requestFeedbackPromise,
1759 1762
             room.leave().then(disconnect, disconnect)
1760
-        ]).then(() => {
1763
+        ]).then(values => {
1761 1764
             APP.API.notifyReadyToClose();
1762
-            maybeRedirectToWelcomePage();
1765
+            maybeRedirectToWelcomePage(values[0]);
1763 1766
         });
1764 1767
     }
1765 1768
 };

+ 12
- 7
modules/UI/UI.js ファイルの表示

@@ -1061,15 +1061,20 @@ UI.updateDTMFSupport = function (isDTMFSupported) {
1061 1061
 };
1062 1062
 
1063 1063
 /**
1064
- * Show user feedback dialog if its required or just show "thank you" dialog.
1065
- * @returns {Promise} when dialog is closed.
1066
- */
1067
-UI.requestFeedback = function () {
1064
+ * Show user feedback dialog if its required and enabled after pressing the
1065
+ * hangup button.
1066
+ * @returns {Promise} Resolved with value - false if the dialog is enabled and
1067
+ * resolved with true if the dialog is disabled or the feedback was already
1068
+ * submitted. Rejected if another dialog is already displayed. This values are
1069
+ * used to display or not display the thank you dialog from 
1070
+ * conference.maybeRedirectToWelcomePage method.
1071
+ */
1072
+UI.requestFeedbackOnHangup = function () {
1068 1073
     if (Feedback.isVisible())
1069 1074
         return Promise.reject(UIErrors.FEEDBACK_REQUEST_IN_PROGRESS);
1070 1075
     // Feedback has been submitted already.
1071 1076
     else if (Feedback.isEnabled() && Feedback.isSubmitted())
1072
-        return Promise.resolve();
1077
+        return Promise.resolve(true);
1073 1078
     else
1074 1079
         return new Promise(function (resolve) {
1075 1080
             if (Feedback.isEnabled()) {
@@ -1077,10 +1082,10 @@ UI.requestFeedback = function () {
1077 1082
                 // window and immidiately start the conference dispose timeout.
1078 1083
                 if (Feedback.getFeedbackScore() > 0) {
1079 1084
                     Feedback.openFeedbackWindow();
1080
-                    resolve();
1085
+                    resolve(false);
1081 1086
 
1082 1087
                 } else { // Otherwise we'll wait for user's feedback.
1083
-                    Feedback.openFeedbackWindow(resolve);
1088
+                    Feedback.openFeedbackWindow(() => resolve(false));
1084 1089
                 }
1085 1090
             } else {
1086 1091
                 // If the feedback functionality isn't enabled we show a thank

読み込み中…
キャンセル
保存