Parcourir la source

SQUASH: changes based on feedback: rename, handle error

master
Leonard Kim il y a 8 ans
Parent
révision
a14886031f

+ 29
- 6
react/features/invite/actions.js Voir le fichier

@@ -10,9 +10,27 @@ declare var $: Function;
10 10
 declare var APP: Object;
11 11
 declare var config: Object;
12 12
 
13
-const CONFERENCE_ID_ENDPOINT = config.conferenceMapperUrl;
14
-const DIAL_IN_NUMBERS_ENDPOINT = config.dialInNumbersUrl;
15
-const MUC_URL = config && config.hosts && config.hosts.muc;
13
+/**
14
+ * The url for the api that matches a conference name and muc to an id.
15
+ *
16
+ * @type {string}
17
+ */
18
+const DIAL_IN_CONF_CODE_URL = config.dialInConfCodeUrl;
19
+
20
+/**
21
+ * The url for the api that returns phone numbers to dial in to the conference
22
+ * and join using the conference id.
23
+ *
24
+ * @type {string}
25
+ */
26
+const DIAL_IN_NUMBERS_URLS = config.dialInNumbersUrl;
27
+
28
+/**
29
+ * The url for the MUC component joined for the conference.
30
+ *
31
+ * @type {string}
32
+ */
33
+const MUC_URL = config.hosts && config.hosts.muc;
16 34
 
17 35
 /**
18 36
  * Opens the Invite Dialog.
@@ -33,16 +51,21 @@ export function openInviteDialog() {
33 51
 export function updateDialInNumbers() {
34 52
     return (dispatch, getState) => {
35 53
 
36
-        if (!CONFERENCE_ID_ENDPOINT || !DIAL_IN_NUMBERS_ENDPOINT || !MUC_URL) {
54
+        if (!DIAL_IN_CONF_CODE_URL || !DIAL_IN_NUMBERS_URLS || !MUC_URL) {
55
+            dispatch({
56
+                type: UPDATE_DIAL_IN_NUMBERS_FAILED,
57
+                error: 'URLs for fetching dial in numbers not properly defined'
58
+            });
59
+
37 60
             return;
38 61
         }
39 62
 
40 63
         const { room } = getState()['features/base/conference'];
41 64
         const conferenceIdUrl
42
-            = `${CONFERENCE_ID_ENDPOINT}?conference=${room}@${MUC_URL}`;
65
+            = `${DIAL_IN_CONF_CODE_URL}?conference=${room}@${MUC_URL}`;
43 66
 
44 67
         Promise.all([
45
-            $.getJSON(DIAL_IN_NUMBERS_ENDPOINT),
68
+            $.getJSON(DIAL_IN_NUMBERS_URLS),
46 69
             $.getJSON(conferenceIdUrl)
47 70
         ]).then(([ numbersResponse, idResponse ]) => {
48 71
             if (!idResponse.conference || !idResponse.id) {

+ 7
- 7
react/features/invite/components/DialInNumbersForm.js Voir le fichier

@@ -27,14 +27,14 @@ class DialInNumbersForm extends Component {
27 27
      */
28 28
     static propTypes = {
29 29
         /**
30
-         * The name of the current user.
30
+         * The redux state representing the dial-in numbers feature.
31 31
          */
32
-        _currentUserName: React.PropTypes.string,
32
+        _dialIn: React.PropTypes.object,
33 33
 
34 34
         /**
35
-         * The redux state representing the dial-in numbers feature.
35
+         * The display name of the local user.
36 36
          */
37
-        _dialIn: React.PropTypes.object,
37
+        _localUserDisplayName: React.PropTypes.string,
38 38
 
39 39
         /**
40 40
          * The url for the JitsiConference.
@@ -292,7 +292,7 @@ class DialInNumbersForm extends Component {
292 292
     _generateCopyText() {
293 293
         const welcome = this.props.t('invite.invitedYouTo', {
294 294
             meetingUrl: this.props.conferenceUrl,
295
-            userName: this.props._currentUserName
295
+            userName: this.props._localUserDisplayName
296 296
         });
297 297
 
298 298
         const callNumber = this.props.t('invite.callNumber',
@@ -390,7 +390,7 @@ class DialInNumbersForm extends Component {
390 390
  * @param {Object} state - The Redux state.
391 391
  * @private
392 392
  * @returns {{
393
- *     _currentUserName: React.PropTypes.string,
393
+ *     _localUserDisplayName: React.PropTypes.string,
394 394
  *     _dialIn: React.PropTypes.object
395 395
  * }}
396 396
  */
@@ -399,7 +399,7 @@ function _mapStateToProps(state) {
399 399
         = getLocalParticipant(state['features/base/participants']);
400 400
 
401 401
     return {
402
-        _currentUserName: name,
402
+        _localUserDisplayName: name,
403 403
         _dialIn: state['features/invite/dial-in']
404 404
     };
405 405
 }

+ 1
- 0
react/features/invite/index.js Voir le fichier

@@ -2,3 +2,4 @@ export * from './actions';
2 2
 export * from './components';
3 3
 
4 4
 import './reducer';
5
+import './middleware';

+ 25
- 0
react/features/invite/middleware.js Voir le fichier

@@ -0,0 +1,25 @@
1
+import { MiddlewareRegistry } from '../base/redux';
2
+
3
+import { UPDATE_DIAL_IN_NUMBERS_FAILED } from './actionTypes';
4
+
5
+const logger = require('jitsi-meet-logger').getLogger(__filename);
6
+
7
+/**
8
+ * Middleware that catches actions fetching dial-in numbers.
9
+ *
10
+ * @param {Store} store - Redux store.
11
+ * @returns {Function}
12
+ */
13
+// eslint-disable-next-line no-unused-vars
14
+MiddlewareRegistry.register(store => next => action => {
15
+    const result = next(action);
16
+
17
+    switch (action.type) {
18
+    case UPDATE_DIAL_IN_NUMBERS_FAILED:
19
+        logger.error('Error encountered while fetching dial-in numbers:',
20
+           action.error);
21
+        break;
22
+    }
23
+
24
+    return result;
25
+});

Chargement…
Annuler
Enregistrer