From de5cd53f8545737674a9fd4c06b3c7d9693d2004 Mon Sep 17 00:00:00 2001 From: Lyubomir Marinov Date: Wed, 7 Dec 2016 16:04:52 -0600 Subject: [PATCH] [RN] Allow uppsercase letters in room names --- react/features/app/functions.js | 2 +- react/features/base/conference/reducer.js | 37 +++++++++++++++++------ 2 files changed, 28 insertions(+), 11 deletions(-) diff --git a/react/features/app/functions.js b/react/features/app/functions.js index c66e14492..1c5a6f230 100644 --- a/react/features/app/functions.js +++ b/react/features/app/functions.js @@ -19,7 +19,7 @@ function _getRoomAndDomainFromUrlObject(url) { if (url) { domain = url.hostname; - room = url.pathname.substr(1).toLowerCase(); + room = url.pathname.substr(1); // Convert empty string to undefined to simplify checks. if (room === '') { diff --git a/react/features/base/conference/reducer.js b/react/features/base/conference/reducer.js index 2c333303c..1790ef3f5 100644 --- a/react/features/base/conference/reducer.js +++ b/react/features/base/conference/reducer.js @@ -59,17 +59,34 @@ ReducerRegistry.register('features/base/conference', 'leavingJitsiConference', action.conference.jitsiConference)); - case SET_ROOM: { - let room = action.room; - - // Technically, there're multiple values which don't represent - // valid room names. Practically, each of them is as bad as the rest - // of them because we can't use any of them to join a conference. - isRoomValid(room) || (room = INITIAL_STATE.room); - - return setStateProperty(state, 'room', room); - } + case SET_ROOM: + return _setRoom(state, action); } return state; }); + +/** + * Reduces a specific Redux action SET_ROOM of the feature base/conference. + * + * @param {Object} state - The Redux state of the feature base/conference. + * @param {Action} action - The Redux action SET_ROOM to reduce. + * @private + * @returns {Object} The new state of the feature base/conference after the + * reduction of the specified action. + */ +function _setRoom(state, action) { + let room = action.room; + + if (isRoomValid(room)) { + // XXX Lib-jitsi-meet does not accept uppercase letters. + room = room.toLowerCase(); + } else { + // Technically, there are multiple values which don't represent valid + // room names. Practically, each of them is as bad as the rest of them + // because we can't use any of them to join a conference. + room = INITIAL_STATE.room; + } + + return setStateProperty(state, 'room', room); +}