Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

SQUASH: changes based on feedback: rename, handle error

Leonard Kima14886031ffe
diff --git a/react/features/invite/actions.js b/react/features/invite/actions.js
index 6e892b6e76..0c2a38063f 100644
--- a/react/features/invite/actions.js
+++ b/react/features/invite/actions.js
@@ -10,9 +10,27 @@ declare var $: Function;
declare var APP: Object;
declare var config: Object;
-const CONFERENCE_ID_ENDPOINT = config.conferenceMapperUrl;
-const DIAL_IN_NUMBERS_ENDPOINT = config.dialInNumbersUrl;
-const MUC_URL = config && config.hosts && config.hosts.muc;
+/**
+ * The url for the api that matches a conference name and muc to an id.
+ *
+ * @type {string}
+ */
+const DIAL_IN_CONF_CODE_URL = config.dialInConfCodeUrl;
+
+/**
+ * The url for the api that returns phone numbers to dial in to the conference
+ * and join using the conference id.
+ *
+ * @type {string}
+ */
+const DIAL_IN_NUMBERS_URLS = config.dialInNumbersUrl;
+
+/**
+ * The url for the MUC component joined for the conference.
+ *
+ * @type {string}
+ */
+const MUC_URL = config.hosts && config.hosts.muc;
/**
* Opens the Invite Dialog.
@@ -33,16 +51,21 @@ export function openInviteDialog() {
export function updateDialInNumbers() {
return (dispatch, getState) => {
- if (!CONFERENCE_ID_ENDPOINT || !DIAL_IN_NUMBERS_ENDPOINT || !MUC_URL) {
+ if (!DIAL_IN_CONF_CODE_URL || !DIAL_IN_NUMBERS_URLS || !MUC_URL) {
+ dispatch({
+ type: UPDATE_DIAL_IN_NUMBERS_FAILED,
+ error: 'URLs for fetching dial in numbers not properly defined'
+ });
+
return;
}
const { room } = getState()['features/base/conference'];
const conferenceIdUrl
- = `${CONFERENCE_ID_ENDPOINT}?conference=${room}@${MUC_URL}`;
+ = `${DIAL_IN_CONF_CODE_URL}?conference=${room}@${MUC_URL}`;
Promise.all([
- $.getJSON(DIAL_IN_NUMBERS_ENDPOINT),
+ $.getJSON(DIAL_IN_NUMBERS_URLS),
$.getJSON(conferenceIdUrl)
]).then(([ numbersResponse, idResponse ]) => {
if (!idResponse.conference || !idResponse.id) {
diff --git a/react/features/invite/components/DialInNumbersForm.js b/react/features/invite/components/DialInNumbersForm.js
index 47e8503c6a..ab9001b74c 100644
--- a/react/features/invite/components/DialInNumbersForm.js
+++ b/react/features/invite/components/DialInNumbersForm.js
@@ -27,14 +27,14 @@ class DialInNumbersForm extends Component {
*/
static propTypes = {
/**
- * The name of the current user.
+ * The redux state representing the dial-in numbers feature.
*/
- _currentUserName: React.PropTypes.string,
+ _dialIn: React.PropTypes.object,
/**
- * The redux state representing the dial-in numbers feature.
+ * The display name of the local user.
*/
- _dialIn: React.PropTypes.object,
+ _localUserDisplayName: React.PropTypes.string,
/**
* The url for the JitsiConference.
@@ -292,7 +292,7 @@ class DialInNumbersForm extends Component {
_generateCopyText() {
const welcome = this.props.t('invite.invitedYouTo', {
meetingUrl: this.props.conferenceUrl,
- userName: this.props._currentUserName
+ userName: this.props._localUserDisplayName
});
const callNumber = this.props.t('invite.callNumber',
@@ -390,7 +390,7 @@ class DialInNumbersForm extends Component {
* @param {Object} state - The Redux state.
* @private
* @returns {{
- * _currentUserName: React.PropTypes.string,
+ * _localUserDisplayName: React.PropTypes.string,
* _dialIn: React.PropTypes.object
* }}
*/
@@ -399,7 +399,7 @@ function _mapStateToProps(state) {
= getLocalParticipant(state['features/base/participants']);
return {
- _currentUserName: name,
+ _localUserDisplayName: name,
_dialIn: state['features/invite/dial-in']
};
}
diff --git a/react/features/invite/index.js b/react/features/invite/index.js
index 582e1f9dd4..085a8cab20 100644
--- a/react/features/invite/index.js
+++ b/react/features/invite/index.js
@@ -2,3 +2,4 @@ export * from './actions';
export * from './components';
import './reducer';
+import './middleware';
diff --git a/react/features/invite/middleware.js b/react/features/invite/middleware.js
new file mode 100644
index 0000000000..531f61efc9
--- /dev/null
+++ b/react/features/invite/middleware.js
@@ -0,0 +1,25 @@
+import { MiddlewareRegistry } from '../base/redux';
+
+import { UPDATE_DIAL_IN_NUMBERS_FAILED } from './actionTypes';
+
+const logger = require('jitsi-meet-logger').getLogger(__filename);
+
+/**
+ * Middleware that catches actions fetching dial-in numbers.
+ *
+ * @param {Store} store - Redux store.
+ * @returns {Function}
+ */
+// eslint-disable-next-line no-unused-vars
+MiddlewareRegistry.register(store => next => action => {
+ const result = next(action);
+
+ switch (action.type) {
+ case UPDATE_DIAL_IN_NUMBERS_FAILED:
+ logger.error('Error encountered while fetching dial-in numbers:',
+ action.error);
+ break;
+ }
+
+ return result;
+});