|
@@ -21,31 +21,13 @@ const logger = require('jitsi-meet-logger').getLogger(__filename);
|
21
|
21
|
* Middleware that captures conference failed and checks for password required
|
22
|
22
|
* error and requests a dialog for user to enter password.
|
23
|
23
|
*
|
24
|
|
- * @param {Store} store - Redux store.
|
|
24
|
+ * @param {Store} store - The redux store.
|
25
|
25
|
* @returns {Function}
|
26
|
26
|
*/
|
27
|
27
|
MiddlewareRegistry.register(store => next => action => {
|
28
|
28
|
switch (action.type) {
|
29
|
|
- case CONFERENCE_FAILED: {
|
30
|
|
- const { conference, error } = action;
|
31
|
|
-
|
32
|
|
- if (conference
|
33
|
|
- && error.name === JitsiConferenceErrors.PASSWORD_REQUIRED) {
|
34
|
|
- // XXX The feature room-lock affords recovery after
|
35
|
|
- // CONFERENCE_FAILED caused by
|
36
|
|
- // JitsiConferenceErrors.PASSWORD_REQUIRED.
|
37
|
|
- if (typeof error.recoverable === 'undefined') {
|
38
|
|
- error.recoverable = true;
|
39
|
|
- }
|
40
|
|
- if (error.recoverable) {
|
41
|
|
- store.dispatch(_openPasswordRequiredPrompt(conference));
|
42
|
|
- }
|
43
|
|
- } else {
|
44
|
|
- store.dispatch(hideDialog(PasswordRequiredPrompt));
|
45
|
|
- store.dispatch(hideDialog(RoomLockPrompt));
|
46
|
|
- }
|
47
|
|
- break;
|
48
|
|
- }
|
|
29
|
+ case CONFERENCE_FAILED:
|
|
30
|
+ return _conferenceFailed(store, next, action);
|
49
|
31
|
|
50
|
32
|
case LOCK_STATE_CHANGED:
|
51
|
33
|
// TODO Remove this logic when all components interested in the lock
|
|
@@ -62,18 +44,49 @@ MiddlewareRegistry.register(store => next => action => {
|
62
|
44
|
return next(action);
|
63
|
45
|
});
|
64
|
46
|
|
|
47
|
+/**
|
|
48
|
+ * Handles errors that occur when a conference fails.
|
|
49
|
+ *
|
|
50
|
+ * @param {Store} store - The redux store in which the specified action is being
|
|
51
|
+ * dispatched.
|
|
52
|
+ * @param {Dispatch} next - The redux {@code dispatch} function to dispatch the
|
|
53
|
+ * specified action to the specified store.
|
|
54
|
+ * @param {Action} action - The redux action {@code CONFERENCE_FAILED} which
|
|
55
|
+ * specifies the details associated with the error and the failed conference.
|
|
56
|
+ * @private
|
|
57
|
+ * @returns {*}
|
|
58
|
+ */
|
|
59
|
+function _conferenceFailed({ dispatch }, next, action) {
|
|
60
|
+ const { conference, error } = action;
|
|
61
|
+
|
|
62
|
+ if (conference && error.name === JitsiConferenceErrors.PASSWORD_REQUIRED) {
|
|
63
|
+ // XXX The feature room-lock affords recovery after CONFERENCE_FAILED
|
|
64
|
+ // caused by JitsiConferenceErrors.PASSWORD_REQUIRED.
|
|
65
|
+ if (typeof error.recoverable === 'undefined') {
|
|
66
|
+ error.recoverable = true;
|
|
67
|
+ }
|
|
68
|
+ if (error.recoverable) {
|
|
69
|
+ dispatch(_openPasswordRequiredPrompt(conference));
|
|
70
|
+ }
|
|
71
|
+ } else {
|
|
72
|
+ dispatch(hideDialog(PasswordRequiredPrompt));
|
|
73
|
+ dispatch(hideDialog(RoomLockPrompt));
|
|
74
|
+ }
|
|
75
|
+
|
|
76
|
+ return next(action);
|
|
77
|
+}
|
|
78
|
+
|
65
|
79
|
/**
|
66
|
80
|
* Handles errors that occur when a password fails to be set.
|
67
|
81
|
*
|
68
|
|
- * @param {Store} store - The Redux store in which the specified action is being
|
|
82
|
+ * @param {Store} store - The redux store in which the specified action is being
|
69
|
83
|
* dispatched.
|
70
|
|
- * @param {Dispatch} next - The Redux dispatch function to dispatch the
|
|
84
|
+ * @param {Dispatch} next - The redux {@code dispatch} function to dispatch the
|
71
|
85
|
* specified action to the specified store.
|
72
|
|
- * @param {Action} action - The Redux action SET_PASSWORD_ERROR which has the
|
73
|
|
- * error type that should be handled.
|
|
86
|
+ * @param {Action} action - The redux action {@code SET_PASSWORD_ERROR} which
|
|
87
|
+ * has the error type that should be handled.
|
74
|
88
|
* @private
|
75
|
|
- * @returns {Object} The new state that is the result of the reduction of the
|
76
|
|
- * specified action.
|
|
89
|
+ * @returns {*}
|
77
|
90
|
*/
|
78
|
91
|
function _setPasswordFailed(store, next, action) {
|
79
|
92
|
if (typeof APP !== 'undefined') {
|