Procházet zdrojové kódy

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
master
virtuacoplenny před 5 roky
rodič
revize
732f2c1963
Žádný účet není propojen s e-mailovou adresou tvůrce revize

+ 7
- 0
doc/api.md Zobrazit soubor

@@ -372,6 +372,13 @@ changes. The listener will receive an object with the following structure:
372 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 382
 * **filmstripDisplayChanged** - event notifications about the visibility of the filmstrip being updated.
376 383
 ```javascript
377 384
 {

+ 6
- 2
modules/API/API.js Zobrazit soubor

@@ -627,10 +627,14 @@ class API {
627 627
      * has been submitted. Intended to be used in conjunction with the
628 628
      * submit-feedback command to get notified if feedback was submitted.
629 629
      *
630
+     * @param {string} error - A failure message, if any.
630 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 Zobrazit soubor

@@ -9073,8 +9073,8 @@
9073 9073
       }
9074 9074
     },
9075 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 9078
       "requires": {
9079 9079
         "@jitsi/sdp-interop": "0.1.14",
9080 9080
         "@jitsi/sdp-simulcast": "0.2.1",

+ 1
- 1
package.json Zobrazit soubor

@@ -54,7 +54,7 @@
54 54
     "js-utils": "github:jitsi/js-utils#192b1c996e8c05530eb1f19e82a31069c3021e31",
55 55
     "jsrsasign": "8.0.12",
56 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 58
     "libflacjs": "github:mmig/libflac.js#93d37e7f811f01cf7d8b6a603e38bd3c3810907d",
59 59
     "lodash": "4.17.11",
60 60
     "moment": "2.19.4",

+ 6
- 2
react/features/external-api/middleware.js Zobrazit soubor

@@ -18,7 +18,7 @@ import {
18 18
 import { MiddlewareRegistry } from '../base/redux';
19 19
 import { getBaseUrl } from '../base/util';
20 20
 import { appendSuffix } from '../display-name';
21
-import { SUBMIT_FEEDBACK } from '../feedback';
21
+import { SUBMIT_FEEDBACK_ERROR, SUBMIT_FEEDBACK_SUCCESS } from '../feedback';
22 22
 import { SET_FILMSTRIP_VISIBLE } from '../filmstrip';
23 23
 
24 24
 declare var APP: Object;
@@ -156,7 +156,11 @@ MiddlewareRegistry.register(store => next => action => {
156 156
         APP.API.notifyFilmstripDisplayChanged(action.visible);
157 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 164
         APP.API.notifyFeedbackSubmitted();
161 165
         break;
162 166
     }

+ 13
- 5
react/features/feedback/actionTypes.js Zobrazit soubor

@@ -10,12 +10,20 @@
10 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 Zobrazit soubor

@@ -5,7 +5,11 @@ import type { Dispatch } from 'redux';
5 5
 import { openDialog } from '../base/dialog';
6 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 13
 import { FeedbackDialog } from './components';
10 14
 
11 15
 declare var config: Object;
@@ -114,17 +118,22 @@ export function openFeedbackDialog(conference: Object, onClose: ?Function) {
114 118
  * rating.
115 119
  * @param {JitsiConference} conference - The JitsiConference for which the
116 120
  * feedback is being left.
117
- * @returns {{
118
- *     type: SUBMIT_FEEDBACK
119
- * }}
121
+ * @returns {Function}
120 122
  */
121 123
 export function submitFeedback(
122 124
         score: number,
123 125
         message: string,
124 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 Zobrazit soubor

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

Načítá se…
Zrušit
Uložit