瀏覽代碼

ref(feedback): emit api feedback submitted on completion (#4499)

* ref(feedback): emit api feedback submitted on completion

Compared to firing the event on submission because
the submission ajax will not be completed at that
time..

* squash: update package.json
j8
virtuacoplenny 6 年之前
父節點
當前提交
732f2c1963
沒有連結到貢獻者的電子郵件帳戶。

+ 7
- 0
doc/api.md 查看文件

372
     email: string // the new email
372
     email: string // the new email
373
 }
373
 }
374
 ```
374
 ```
375
+* **feedbackSubmitted** - event notifications about conference feedback submission
376
+```javascript
377
+{
378
+    error: string // The error which occurred during submission, if any.
379
+}
380
+```
381
+
375
 * **filmstripDisplayChanged** - event notifications about the visibility of the filmstrip being updated.
382
 * **filmstripDisplayChanged** - event notifications about the visibility of the filmstrip being updated.
376
 ```javascript
383
 ```javascript
377
 {
384
 {

+ 6
- 2
modules/API/API.js 查看文件

627
      * has been submitted. Intended to be used in conjunction with the
627
      * has been submitted. Intended to be used in conjunction with the
628
      * submit-feedback command to get notified if feedback was submitted.
628
      * submit-feedback command to get notified if feedback was submitted.
629
      *
629
      *
630
+     * @param {string} error - A failure message, if any.
630
      * @returns {void}
631
      * @returns {void}
631
      */
632
      */
632
-    notifyFeedbackSubmitted() {
633
-        this._sendEvent({ name: 'feedback-submitted' });
633
+    notifyFeedbackSubmitted(error: string) {
634
+        this._sendEvent({
635
+            name: 'feedback-submitted',
636
+            error
637
+        });
634
     }
638
     }
635
 
639
 
636
     /**
640
     /**

+ 2
- 2
package-lock.json 查看文件

9073
       }
9073
       }
9074
     },
9074
     },
9075
     "lib-jitsi-meet": {
9075
     "lib-jitsi-meet": {
9076
-      "version": "github:jitsi/lib-jitsi-meet#502ba82e1e4e4cdf8fe768566b6414f5c100491a",
9077
-      "from": "github:jitsi/lib-jitsi-meet#502ba82e1e4e4cdf8fe768566b6414f5c100491a",
9076
+      "version": "github:jitsi/lib-jitsi-meet#97475026de59442f9b8a50d5abed6131a0b1c544",
9077
+      "from": "github:jitsi/lib-jitsi-meet#97475026de59442f9b8a50d5abed6131a0b1c544",
9078
       "requires": {
9078
       "requires": {
9079
         "@jitsi/sdp-interop": "0.1.14",
9079
         "@jitsi/sdp-interop": "0.1.14",
9080
         "@jitsi/sdp-simulcast": "0.2.1",
9080
         "@jitsi/sdp-simulcast": "0.2.1",

+ 1
- 1
package.json 查看文件

54
     "js-utils": "github:jitsi/js-utils#192b1c996e8c05530eb1f19e82a31069c3021e31",
54
     "js-utils": "github:jitsi/js-utils#192b1c996e8c05530eb1f19e82a31069c3021e31",
55
     "jsrsasign": "8.0.12",
55
     "jsrsasign": "8.0.12",
56
     "jwt-decode": "2.2.0",
56
     "jwt-decode": "2.2.0",
57
-    "lib-jitsi-meet": "github:jitsi/lib-jitsi-meet#502ba82e1e4e4cdf8fe768566b6414f5c100491a",
57
+    "lib-jitsi-meet": "github:jitsi/lib-jitsi-meet#97475026de59442f9b8a50d5abed6131a0b1c544",
58
     "libflacjs": "github:mmig/libflac.js#93d37e7f811f01cf7d8b6a603e38bd3c3810907d",
58
     "libflacjs": "github:mmig/libflac.js#93d37e7f811f01cf7d8b6a603e38bd3c3810907d",
59
     "lodash": "4.17.11",
59
     "lodash": "4.17.11",
60
     "moment": "2.19.4",
60
     "moment": "2.19.4",

+ 6
- 2
react/features/external-api/middleware.js 查看文件

18
 import { MiddlewareRegistry } from '../base/redux';
18
 import { MiddlewareRegistry } from '../base/redux';
19
 import { getBaseUrl } from '../base/util';
19
 import { getBaseUrl } from '../base/util';
20
 import { appendSuffix } from '../display-name';
20
 import { appendSuffix } from '../display-name';
21
-import { SUBMIT_FEEDBACK } from '../feedback';
21
+import { SUBMIT_FEEDBACK_ERROR, SUBMIT_FEEDBACK_SUCCESS } from '../feedback';
22
 import { SET_FILMSTRIP_VISIBLE } from '../filmstrip';
22
 import { SET_FILMSTRIP_VISIBLE } from '../filmstrip';
23
 
23
 
24
 declare var APP: Object;
24
 declare var APP: Object;
156
         APP.API.notifyFilmstripDisplayChanged(action.visible);
156
         APP.API.notifyFilmstripDisplayChanged(action.visible);
157
         break;
157
         break;
158
 
158
 
159
-    case SUBMIT_FEEDBACK:
159
+    case SUBMIT_FEEDBACK_ERROR:
160
+        APP.API.notifyFeedbackSubmitted(action.error || 'Unknown error');
161
+        break;
162
+
163
+    case SUBMIT_FEEDBACK_SUCCESS:
160
         APP.API.notifyFeedbackSubmitted();
164
         APP.API.notifyFeedbackSubmitted();
161
         break;
165
         break;
162
     }
166
     }

+ 13
- 5
react/features/feedback/actionTypes.js 查看文件

10
 export const CANCEL_FEEDBACK = 'CANCEL_FEEDBACK';
10
 export const CANCEL_FEEDBACK = 'CANCEL_FEEDBACK';
11
 
11
 
12
 /**
12
 /**
13
- * The type of the action which signals feedback was submitted for recording.
13
+ * The type of the action which signals feedback failed to be recorded.
14
  *
14
  *
15
  * {
15
  * {
16
- *     type: SUBMIT_FEEDBACK,
17
- *     message: string,
18
- *     score: number
16
+ *     type: SUBMIT_FEEDBACK_ERROR
17
+ *     error: string
18
+ * }
19
+ */
20
+export const SUBMIT_FEEDBACK_ERROR = 'SUBMIT_FEEDBACK_ERROR';
21
+
22
+/**
23
+ * The type of the action which signals feedback has been recorded.
24
+ *
25
+ * {
26
+ *     type: SUBMIT_FEEDBACK_SUCCESS,
19
  * }
27
  * }
20
  */
28
  */
21
-export const SUBMIT_FEEDBACK = 'SUBMIT_FEEDBACK';
29
+export const SUBMIT_FEEDBACK_SUCCESS = 'SUBMIT_FEEDBACK_SUCCESS';

+ 17
- 8
react/features/feedback/actions.js 查看文件

5
 import { openDialog } from '../base/dialog';
5
 import { openDialog } from '../base/dialog';
6
 import { FEEDBACK_REQUEST_IN_PROGRESS } from '../../../modules/UI/UIErrors';
6
 import { FEEDBACK_REQUEST_IN_PROGRESS } from '../../../modules/UI/UIErrors';
7
 
7
 
8
-import { CANCEL_FEEDBACK, SUBMIT_FEEDBACK } from './actionTypes';
8
+import {
9
+    CANCEL_FEEDBACK,
10
+    SUBMIT_FEEDBACK_ERROR,
11
+    SUBMIT_FEEDBACK_SUCCESS
12
+} from './actionTypes';
9
 import { FeedbackDialog } from './components';
13
 import { FeedbackDialog } from './components';
10
 
14
 
11
 declare var config: Object;
15
 declare var config: Object;
114
  * rating.
118
  * rating.
115
  * @param {JitsiConference} conference - The JitsiConference for which the
119
  * @param {JitsiConference} conference - The JitsiConference for which the
116
  * feedback is being left.
120
  * feedback is being left.
117
- * @returns {{
118
- *     type: SUBMIT_FEEDBACK
119
- * }}
121
+ * @returns {Function}
120
  */
122
  */
121
 export function submitFeedback(
123
 export function submitFeedback(
122
         score: number,
124
         score: number,
123
         message: string,
125
         message: string,
124
         conference: Object) {
126
         conference: Object) {
125
-    conference.sendFeedback(score, message);
127
+    return (dispatch: Dispatch<any>) => conference.sendFeedback(score, message)
128
+        .then(
129
+            () => dispatch({ type: SUBMIT_FEEDBACK_SUCCESS }),
130
+            error => {
131
+                dispatch({
132
+                    type: SUBMIT_FEEDBACK_ERROR,
133
+                    error
134
+                });
126
 
135
 
127
-    return {
128
-        type: SUBMIT_FEEDBACK
129
-    };
136
+                return Promise.reject(error);
137
+            }
138
+        );
130
 }
139
 }

+ 4
- 2
react/features/feedback/reducer.js 查看文件

4
 
4
 
5
 import {
5
 import {
6
     CANCEL_FEEDBACK,
6
     CANCEL_FEEDBACK,
7
-    SUBMIT_FEEDBACK
7
+    SUBMIT_FEEDBACK_ERROR,
8
+    SUBMIT_FEEDBACK_SUCCESS
8
 } from './actionTypes';
9
 } from './actionTypes';
9
 
10
 
10
 const DEFAULT_STATE = {
11
 const DEFAULT_STATE = {
31
             };
32
             };
32
         }
33
         }
33
 
34
 
34
-        case SUBMIT_FEEDBACK: {
35
+        case SUBMIT_FEEDBACK_ERROR:
36
+        case SUBMIT_FEEDBACK_SUCCESS: {
35
             return {
37
             return {
36
                 ...state,
38
                 ...state,
37
                 message: '',
39
                 message: '',

Loading…
取消
儲存