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
This commit is contained in:
virtuacoplenny 2019-07-31 10:59:22 -07:00 committed by GitHub
parent e7144eb674
commit 732f2c1963
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 56 additions and 22 deletions

View File

@ -372,6 +372,13 @@ changes. The listener will receive an object with the following structure:
email: string // the new email email: string // the new email
} }
``` ```
* **feedbackSubmitted** - event notifications about conference feedback submission
```javascript
{
error: string // The error which occurred during submission, if any.
}
```
* **filmstripDisplayChanged** - event notifications about the visibility of the filmstrip being updated. * **filmstripDisplayChanged** - event notifications about the visibility of the filmstrip being updated.
```javascript ```javascript
{ {

View File

@ -627,10 +627,14 @@ class API {
* has been submitted. Intended to be used in conjunction with the * has been submitted. Intended to be used in conjunction with the
* submit-feedback command to get notified if feedback was submitted. * submit-feedback command to get notified if feedback was submitted.
* *
* @param {string} error - A failure message, if any.
* @returns {void} * @returns {void}
*/ */
notifyFeedbackSubmitted() { notifyFeedbackSubmitted(error: string) {
this._sendEvent({ name: 'feedback-submitted' }); this._sendEvent({
name: 'feedback-submitted',
error
});
} }
/** /**

4
package-lock.json generated
View File

@ -9073,8 +9073,8 @@
} }
}, },
"lib-jitsi-meet": { "lib-jitsi-meet": {
"version": "github:jitsi/lib-jitsi-meet#502ba82e1e4e4cdf8fe768566b6414f5c100491a", "version": "github:jitsi/lib-jitsi-meet#97475026de59442f9b8a50d5abed6131a0b1c544",
"from": "github:jitsi/lib-jitsi-meet#502ba82e1e4e4cdf8fe768566b6414f5c100491a", "from": "github:jitsi/lib-jitsi-meet#97475026de59442f9b8a50d5abed6131a0b1c544",
"requires": { "requires": {
"@jitsi/sdp-interop": "0.1.14", "@jitsi/sdp-interop": "0.1.14",
"@jitsi/sdp-simulcast": "0.2.1", "@jitsi/sdp-simulcast": "0.2.1",

View File

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

View File

@ -18,7 +18,7 @@ import {
import { MiddlewareRegistry } from '../base/redux'; import { MiddlewareRegistry } from '../base/redux';
import { getBaseUrl } from '../base/util'; import { getBaseUrl } from '../base/util';
import { appendSuffix } from '../display-name'; import { appendSuffix } from '../display-name';
import { SUBMIT_FEEDBACK } from '../feedback'; import { SUBMIT_FEEDBACK_ERROR, SUBMIT_FEEDBACK_SUCCESS } from '../feedback';
import { SET_FILMSTRIP_VISIBLE } from '../filmstrip'; import { SET_FILMSTRIP_VISIBLE } from '../filmstrip';
declare var APP: Object; declare var APP: Object;
@ -156,7 +156,11 @@ MiddlewareRegistry.register(store => next => action => {
APP.API.notifyFilmstripDisplayChanged(action.visible); APP.API.notifyFilmstripDisplayChanged(action.visible);
break; break;
case SUBMIT_FEEDBACK: case SUBMIT_FEEDBACK_ERROR:
APP.API.notifyFeedbackSubmitted(action.error || 'Unknown error');
break;
case SUBMIT_FEEDBACK_SUCCESS:
APP.API.notifyFeedbackSubmitted(); APP.API.notifyFeedbackSubmitted();
break; break;
} }

View File

@ -10,12 +10,20 @@
export const CANCEL_FEEDBACK = 'CANCEL_FEEDBACK'; export const CANCEL_FEEDBACK = 'CANCEL_FEEDBACK';
/** /**
* The type of the action which signals feedback was submitted for recording. * The type of the action which signals feedback failed to be recorded.
* *
* { * {
* type: SUBMIT_FEEDBACK, * type: SUBMIT_FEEDBACK_ERROR
* message: string, * error: string
* score: number
* } * }
*/ */
export const SUBMIT_FEEDBACK = 'SUBMIT_FEEDBACK'; export const SUBMIT_FEEDBACK_ERROR = 'SUBMIT_FEEDBACK_ERROR';
/**
* The type of the action which signals feedback has been recorded.
*
* {
* type: SUBMIT_FEEDBACK_SUCCESS,
* }
*/
export const SUBMIT_FEEDBACK_SUCCESS = 'SUBMIT_FEEDBACK_SUCCESS';

View File

@ -5,7 +5,11 @@ import type { Dispatch } from 'redux';
import { openDialog } from '../base/dialog'; import { openDialog } from '../base/dialog';
import { FEEDBACK_REQUEST_IN_PROGRESS } from '../../../modules/UI/UIErrors'; import { FEEDBACK_REQUEST_IN_PROGRESS } from '../../../modules/UI/UIErrors';
import { CANCEL_FEEDBACK, SUBMIT_FEEDBACK } from './actionTypes'; import {
CANCEL_FEEDBACK,
SUBMIT_FEEDBACK_ERROR,
SUBMIT_FEEDBACK_SUCCESS
} from './actionTypes';
import { FeedbackDialog } from './components'; import { FeedbackDialog } from './components';
declare var config: Object; declare var config: Object;
@ -114,17 +118,22 @@ export function openFeedbackDialog(conference: Object, onClose: ?Function) {
* rating. * rating.
* @param {JitsiConference} conference - The JitsiConference for which the * @param {JitsiConference} conference - The JitsiConference for which the
* feedback is being left. * feedback is being left.
* @returns {{ * @returns {Function}
* type: SUBMIT_FEEDBACK
* }}
*/ */
export function submitFeedback( export function submitFeedback(
score: number, score: number,
message: string, message: string,
conference: Object) { conference: Object) {
conference.sendFeedback(score, message); return (dispatch: Dispatch<any>) => conference.sendFeedback(score, message)
.then(
() => dispatch({ type: SUBMIT_FEEDBACK_SUCCESS }),
error => {
dispatch({
type: SUBMIT_FEEDBACK_ERROR,
error
});
return { return Promise.reject(error);
type: SUBMIT_FEEDBACK }
}; );
} }

View File

@ -4,7 +4,8 @@ import {
import { import {
CANCEL_FEEDBACK, CANCEL_FEEDBACK,
SUBMIT_FEEDBACK SUBMIT_FEEDBACK_ERROR,
SUBMIT_FEEDBACK_SUCCESS
} from './actionTypes'; } from './actionTypes';
const DEFAULT_STATE = { const DEFAULT_STATE = {
@ -31,7 +32,8 @@ ReducerRegistry.register(
}; };
} }
case SUBMIT_FEEDBACK: { case SUBMIT_FEEDBACK_ERROR:
case SUBMIT_FEEDBACK_SUCCESS: {
return { return {
...state, ...state,
message: '', message: '',