From da1e79af8f671f98f291ca5713e8516fd66e6d77 Mon Sep 17 00:00:00 2001 From: damencho Date: Mon, 10 Jul 2023 13:40:49 -0500 Subject: [PATCH 1/5] feat: Returns an error on join request with no display name. When someone tries to join a room with lobby enabled and display name is not set returns an error. --- react/features/prejoin/reducer.ts | 12 ++++++++++++ resources/prosody-plugins/mod_muc_lobby_rooms.lua | 11 +++++++++++ 2 files changed, 23 insertions(+) diff --git a/react/features/prejoin/reducer.ts b/react/features/prejoin/reducer.ts index 3c66259d54c63..f78e5e66f0e82 100644 --- a/react/features/prejoin/reducer.ts +++ b/react/features/prejoin/reducer.ts @@ -1,3 +1,5 @@ +import { CONFERENCE_FAILED } from '../base/conference/actionTypes'; +import { JitsiConferenceErrors } from '../base/lib-jitsi-meet'; import PersistenceRegistry from '../base/redux/PersistenceRegistry'; import ReducerRegistry from '../base/redux/ReducerRegistry'; @@ -72,6 +74,16 @@ PersistenceRegistry.register('features/prejoin', { ReducerRegistry.register( 'features/prejoin', (state = DEFAULT_STATE, action): IPrejoinState => { switch (action.type) { + case CONFERENCE_FAILED: { + if (action.error.name === JitsiConferenceErrors.DISPLAY_NAME_REQUIRED) { + return { + ...state, + isDisplayNameRequired: true + }; + } + + return state; + } case PREJOIN_JOINING_IN_PROGRESS: return { ...state, diff --git a/resources/prosody-plugins/mod_muc_lobby_rooms.lua b/resources/prosody-plugins/mod_muc_lobby_rooms.lua index 54105da0e056d..96a8164aeb390 100644 --- a/resources/prosody-plugins/mod_muc_lobby_rooms.lua +++ b/resources/prosody-plugins/mod_muc_lobby_rooms.lua @@ -400,6 +400,17 @@ process_host_module(main_muc_component_config, function(host_module, host) end end + -- Check for display name if missing return an error + local displayName = stanza:get_child_text('nick', 'http://jabber.org/protocol/nick'); + if not displayName or #displayName == 0 then + local reply = st.error_reply(stanza, 'modify', 'not-acceptable'); + reply.tags[1].attr.code = '406'; + reply:tag('displayname-required', { xmlns = 'http://jitsi.org/jitmeet' }):up():up(); + + event.origin.send(reply:tag('x', {xmlns = MUC_NS})); + return true; + end + -- we want to add the custom lobbyroom field to fill in the lobby room jid local invitee = event.stanza.attr.from; local affiliation = room:get_affiliation(invitee); From 1a3b3af79a12a5d77e5aa20c063dc64f296560b0 Mon Sep 17 00:00:00 2001 From: damencho Date: Tue, 11 Jul 2023 14:39:25 -0500 Subject: [PATCH 2/5] squash: Fixes handling DISPLAY_NAME_REQUIRED with preJoin disabled. --- react/features/lobby/actions.any.ts | 12 ++++++++++ .../lobby/components/AbstractLobbyScreen.tsx | 8 ++++++- .../lobby/components/web/LobbyScreen.tsx | 23 ++++++++++++------- react/features/lobby/middleware.ts | 19 +++++++++++++-- react/features/lobby/reducer.ts | 20 +++++++++++++++- .../prosody-plugins/mod_muc_lobby_rooms.lua | 2 +- 6 files changed, 71 insertions(+), 13 deletions(-) diff --git a/react/features/lobby/actions.any.ts b/react/features/lobby/actions.any.ts index 44409e0065376..c2688dbadce1f 100644 --- a/react/features/lobby/actions.any.ts +++ b/react/features/lobby/actions.any.ts @@ -8,6 +8,7 @@ import { LOBBY_CHAT_MESSAGE } from '../chat/constants'; import { handleLobbyMessageReceived } from '../chat/middleware'; import { hideNotification, showNotification } from '../notifications/actions'; import { LOBBY_NOTIFICATION_ID } from '../notifications/constants'; +import { joinConference } from '../prejoin/actions'; import { KNOCKING_PARTICIPANT_ARRIVED_OR_UPDATED, @@ -205,6 +206,17 @@ export function startKnocking() { return async (dispatch: IStore['dispatch'], getState: IStore['getState']) => { const state = getState(); const { membersOnly } = state['features/base/conference']; + + if (!membersOnly) { + + // no membersOnly, this means we got lobby screen shown as someone + // tried to join a conference that has lobby enabled without setting display name + // join conference should trigger the lobby/member_only path after setting the display name + dispatch(joinConference()); + + return; + } + const localParticipant = getLocalParticipant(state); dispatch(conferenceWillJoin(membersOnly)); diff --git a/react/features/lobby/components/AbstractLobbyScreen.tsx b/react/features/lobby/components/AbstractLobbyScreen.tsx index c0575ad639f96..984cf20996171 100644 --- a/react/features/lobby/components/AbstractLobbyScreen.tsx +++ b/react/features/lobby/components/AbstractLobbyScreen.tsx @@ -27,6 +27,11 @@ export interface IProps { */ _deviceStatusVisible: boolean; + /** + * Indicates whether the message that display name is required is shown. + */ + _isDisplayNameRequiredActive: boolean; + /** * True if moderator initiated a chat session with the participant. */ @@ -435,7 +440,7 @@ export function _mapStateToProps(state: IReduxState) { const participantId = localParticipant?.id; const inviteEnabledFlag = getFeatureFlag(state, INVITE_ENABLED, true); const { disableInviteFunctions } = state['features/base/config']; - const { knocking, passwordJoinFailed } = state['features/lobby']; + const { isDisplayNameRequired, knocking, passwordJoinFailed } = state['features/lobby']; const { iAmSipGateway } = state['features/base/config']; const { disableLobbyPassword } = getSecurityUiConfig(state); const showCopyUrlButton = inviteEnabledFlag || !disableInviteFunctions; @@ -445,6 +450,7 @@ export function _mapStateToProps(state: IReduxState) { return { _deviceStatusVisible: deviceStatusVisible, + _isDisplayNameRequiredActive: isDisplayNameRequired, _knocking: knocking, _lobbyChatMessages: messages, _lobbyMessageRecipient: lobbyMessageRecipient?.name, diff --git a/react/features/lobby/components/web/LobbyScreen.tsx b/react/features/lobby/components/web/LobbyScreen.tsx index f68e64556a6c1..790da31f54c95 100644 --- a/react/features/lobby/components/web/LobbyScreen.tsx +++ b/react/features/lobby/components/web/LobbyScreen.tsx @@ -153,16 +153,23 @@ class LobbyScreen extends AbstractLobbyScreen { */ _renderParticipantInfo() { const { displayName } = this.state; - const { t } = this.props; + const { _isDisplayNameRequiredActive, t } = this.props; return ( - + <> + + + {_isDisplayNameRequiredActive &&
{t('prejoin.errorMissingName')}
} + ); } diff --git a/react/features/lobby/middleware.ts b/react/features/lobby/middleware.ts index a4aa545aa6f56..48e23d8ebc085 100644 --- a/react/features/lobby/middleware.ts +++ b/react/features/lobby/middleware.ts @@ -41,7 +41,7 @@ import { import { INotificationProps } from '../notifications/types'; import { open as openParticipantsPane } from '../participants-pane/actions'; import { getParticipantsPaneOpen } from '../participants-pane/functions'; -import { shouldAutoKnock } from '../prejoin/functions'; +import { isPrejoinPageVisible, shouldAutoKnock } from '../prejoin/functions'; import { KNOCKING_PARTICIPANT_ARRIVED_OR_UPDATED, @@ -267,6 +267,8 @@ function _conferenceFailed({ dispatch, getState }: IStore, next: Function, actio const state = getState(); const { membersOnly } = state['features/base/conference']; const nonFirstFailure = Boolean(membersOnly); + const { isDisplayNameRequired } = state['features/lobby']; + const { prejoinConfig } = state['features/base/config']; if (error.name === JitsiConferenceErrors.MEMBERS_ONLY_ERROR) { if (typeof error.recoverable === 'undefined') { @@ -277,7 +279,8 @@ function _conferenceFailed({ dispatch, getState }: IStore, next: Function, actio dispatch(openLobbyScreen()); - if (shouldAutoKnock(state)) { + // if there was an error about display name and pre-join is not enabled + if (shouldAutoKnock(state) || (isDisplayNameRequired && !prejoinConfig?.enabled)) { dispatch(startKnocking()); } @@ -288,6 +291,18 @@ function _conferenceFailed({ dispatch, getState }: IStore, next: Function, actio dispatch(setPasswordJoinFailed(nonFirstFailure)); + return result; + } else if (error.name === JitsiConferenceErrors.DISPLAY_NAME_REQUIRED) { + const [ isLobbyEnabled ] = error.params; + + const result = next(action); + + // if the error is due to required display name because lobby is enabled for the room + // if not showing the prejoin page then show lobby UI + if (isLobbyEnabled && !isPrejoinPageVisible(state)) { + dispatch(openLobbyScreen()); + } + return result; } diff --git a/react/features/lobby/reducer.ts b/react/features/lobby/reducer.ts index a2d494a6dade3..01c6255d65d35 100644 --- a/react/features/lobby/reducer.ts +++ b/react/features/lobby/reducer.ts @@ -1,4 +1,10 @@ -import { CONFERENCE_JOINED, CONFERENCE_LEFT, SET_PASSWORD } from '../base/conference/actionTypes'; +import { + CONFERENCE_FAILED, + CONFERENCE_JOINED, + CONFERENCE_LEFT, + SET_PASSWORD +} from '../base/conference/actionTypes'; +import { JitsiConferenceErrors } from '../base/lib-jitsi-meet'; import ReducerRegistry from '../base/redux/ReducerRegistry'; import { @@ -14,6 +20,7 @@ import { import { IKnockingParticipant } from './types'; const DEFAULT_STATE = { + isDisplayNameRequired: false, knocking: false, knockingParticipants: [], lobbyEnabled: false, @@ -22,6 +29,7 @@ const DEFAULT_STATE = { }; export interface ILobbyState { + isDisplayNameRequired: boolean; knocking: boolean; knockingParticipants: IKnockingParticipant[]; lobbyEnabled: boolean; @@ -39,6 +47,16 @@ export interface ILobbyState { */ ReducerRegistry.register('features/lobby', (state = DEFAULT_STATE, action): ILobbyState => { switch (action.type) { + case CONFERENCE_FAILED: { + if (action.error.name === JitsiConferenceErrors.DISPLAY_NAME_REQUIRED) { + return { + ...state, + isDisplayNameRequired: true + }; + } + + return state; + } case CONFERENCE_JOINED: case CONFERENCE_LEFT: return { diff --git a/resources/prosody-plugins/mod_muc_lobby_rooms.lua b/resources/prosody-plugins/mod_muc_lobby_rooms.lua index 96a8164aeb390..75896ed2d3da4 100644 --- a/resources/prosody-plugins/mod_muc_lobby_rooms.lua +++ b/resources/prosody-plugins/mod_muc_lobby_rooms.lua @@ -405,7 +405,7 @@ process_host_module(main_muc_component_config, function(host_module, host) if not displayName or #displayName == 0 then local reply = st.error_reply(stanza, 'modify', 'not-acceptable'); reply.tags[1].attr.code = '406'; - reply:tag('displayname-required', { xmlns = 'http://jitsi.org/jitmeet' }):up():up(); + reply:tag('displayname-required', { xmlns = 'http://jitsi.org/jitmeet', lobby = 'true' }):up():up(); event.origin.send(reply:tag('x', {xmlns = MUC_NS})); return true; From b6eca0770f89d58d8131d62d5cae0a5a6db08292 Mon Sep 17 00:00:00 2001 From: damencho Date: Tue, 11 Jul 2023 14:58:05 -0500 Subject: [PATCH 3/5] squash: Fixes mobile build. --- react/features/lobby/actions.any.ts | 1 + react/features/prejoin/actions.native.ts | 15 +++++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 react/features/prejoin/actions.native.ts diff --git a/react/features/lobby/actions.any.ts b/react/features/lobby/actions.any.ts index c2688dbadce1f..46f2c60c1b31e 100644 --- a/react/features/lobby/actions.any.ts +++ b/react/features/lobby/actions.any.ts @@ -212,6 +212,7 @@ export function startKnocking() { // no membersOnly, this means we got lobby screen shown as someone // tried to join a conference that has lobby enabled without setting display name // join conference should trigger the lobby/member_only path after setting the display name + // this is possible only for web, where we can join without a prejoin screen dispatch(joinConference()); return; diff --git a/react/features/prejoin/actions.native.ts b/react/features/prejoin/actions.native.ts new file mode 100644 index 0000000000000..ad0295603cd82 --- /dev/null +++ b/react/features/prejoin/actions.native.ts @@ -0,0 +1,15 @@ +// we need for using joinConference from actions.web in actions.any in lobby feature +import { IStore } from '../app/types'; + +/** + * Action used to start the conference. + * + * @param {Object} options - The config options that override the default ones (if any). + * @param {boolean} _ignoreJoiningInProgress - If true we won't check the joiningInProgress flag. + * @returns {Function} + */ +export function joinConference(options?: Object, _ignoreJoiningInProgress = false) { + // eslint-disable-next-line @typescript-eslint/no-empty-function + return async function(_dispatch: IStore['dispatch'], _getState: IStore['getState']) { + }; +} From 13189db8b5acfb0c1639860e5160e6a4b1b90808 Mon Sep 17 00:00:00 2001 From: damencho Date: Tue, 18 Jul 2023 11:54:13 -0500 Subject: [PATCH 4/5] squash: Move isDisplayNameRequired redux state in lobby and introduces isDisplayNameRequiredError. --- react/features/base/connection/actions.any.ts | 8 +++---- react/features/lobby/actionTypes.ts | 7 +++++- react/features/lobby/actions.any.ts | 12 ++++++++++ .../lobby/components/AbstractLobbyScreen.tsx | 4 ++-- .../lobby/components/web/LobbyScreen.tsx | 6 +++-- react/features/lobby/middleware.ts | 4 ++-- react/features/lobby/reducer.ts | 20 ++++++++++++++++- react/features/prejoin/actionTypes.ts | 5 ----- react/features/prejoin/actions.any.ts | 14 ------------ react/features/prejoin/actions.native.ts | 1 - react/features/prejoin/actions.web.ts | 2 -- .../prejoin/components/web/Prejoin.tsx | 3 ++- react/features/prejoin/functions.ts | 2 +- react/features/prejoin/reducer.ts | 22 ------------------- 14 files changed, 52 insertions(+), 58 deletions(-) delete mode 100644 react/features/prejoin/actions.any.ts diff --git a/react/features/base/connection/actions.any.ts b/react/features/base/connection/actions.any.ts index 0d14747a9e5e3..d2bc27cc31fee 100644 --- a/react/features/base/connection/actions.any.ts +++ b/react/features/base/connection/actions.any.ts @@ -1,7 +1,7 @@ import _ from 'lodash'; import { IReduxState, IStore } from '../../app/types'; -import { setPrejoinDisplayNameRequired } from '../../prejoin/actions.any'; +import { setLobbyDisplayNameRequired } from '../../lobby/actions'; import { conferenceLeft, conferenceWillLeave } from '../conference/actions'; import { getCurrentConference } from '../conference/functions'; import JitsiMeetJS, { JitsiConnectionEvents } from '../lib-jitsi-meet'; @@ -233,12 +233,12 @@ export function _connectInternal(id?: string, password?: string) { _onConnectionFailed); /** - * Marks the display name for the prejoin screen as required. - * This can happen if a user tries to join a room with lobby enabled. + * Marks the display name for the lobby/prejoin screen as required. + * This can happen if a user tries to join a room with lobby enabled and no display name set. */ connection.addEventListener( JitsiConnectionEvents.DISPLAY_NAME_REQUIRED, - () => dispatch(setPrejoinDisplayNameRequired()) + () => dispatch(setLobbyDisplayNameRequired()) ); /** diff --git a/react/features/lobby/actionTypes.ts b/react/features/lobby/actionTypes.ts index a7a209a1afeed..1460d427031aa 100644 --- a/react/features/lobby/actionTypes.ts +++ b/react/features/lobby/actionTypes.ts @@ -28,6 +28,11 @@ export const SET_LOBBY_VISIBILITY = 'TOGGLE_LOBBY_VISIBILITY'; */ export const SET_PASSWORD_JOIN_FAILED = 'SET_PASSWORD_JOIN_FAILED'; +/** + * Action type used to set that the display name on lobby/prejoin screen is manadatory. + */ +export const SET_LOBBY_DISPLAY_NAME_REQUIRED = 'SET_LOBBY_DISPLAY_NAME_REQUIRED'; + /** * Action type to set a lobby chat participant's state to chatting */ @@ -36,4 +41,4 @@ export const SET_PASSWORD_JOIN_FAILED = 'SET_PASSWORD_JOIN_FAILED'; /** * Action type to remove chattingWithModerator field */ - export const REMOVE_LOBBY_CHAT_WITH_MODERATOR = 'REMOVE_LOBBY_CHAT_WITH_MODERATOR'; \ No newline at end of file + export const REMOVE_LOBBY_CHAT_WITH_MODERATOR = 'REMOVE_LOBBY_CHAT_WITH_MODERATOR'; diff --git a/react/features/lobby/actions.any.ts b/react/features/lobby/actions.any.ts index 46f2c60c1b31e..956a4f672366c 100644 --- a/react/features/lobby/actions.any.ts +++ b/react/features/lobby/actions.any.ts @@ -15,6 +15,7 @@ import { KNOCKING_PARTICIPANT_LEFT, REMOVE_LOBBY_CHAT_WITH_MODERATOR, SET_KNOCKING_STATE, + SET_LOBBY_DISPLAY_NAME_REQUIRED, SET_LOBBY_MODE_ENABLED, SET_LOBBY_PARTICIPANT_CHAT_STATE, SET_LOBBY_VISIBILITY, @@ -419,3 +420,14 @@ export function setLobbyMessageListener() { }); }; } + +/** + * Action used to set the stance of the display name. + * + * @returns {Object} + */ +export function setLobbyDisplayNameRequired() { + return { + type: SET_LOBBY_DISPLAY_NAME_REQUIRED + }; +} diff --git a/react/features/lobby/components/AbstractLobbyScreen.tsx b/react/features/lobby/components/AbstractLobbyScreen.tsx index 984cf20996171..22a7467c75123 100644 --- a/react/features/lobby/components/AbstractLobbyScreen.tsx +++ b/react/features/lobby/components/AbstractLobbyScreen.tsx @@ -440,7 +440,7 @@ export function _mapStateToProps(state: IReduxState) { const participantId = localParticipant?.id; const inviteEnabledFlag = getFeatureFlag(state, INVITE_ENABLED, true); const { disableInviteFunctions } = state['features/base/config']; - const { isDisplayNameRequired, knocking, passwordJoinFailed } = state['features/lobby']; + const { isDisplayNameRequiredError, knocking, passwordJoinFailed } = state['features/lobby']; const { iAmSipGateway } = state['features/base/config']; const { disableLobbyPassword } = getSecurityUiConfig(state); const showCopyUrlButton = inviteEnabledFlag || !disableInviteFunctions; @@ -450,7 +450,7 @@ export function _mapStateToProps(state: IReduxState) { return { _deviceStatusVisible: deviceStatusVisible, - _isDisplayNameRequiredActive: isDisplayNameRequired, + _isDisplayNameRequiredActive: Boolean(isDisplayNameRequiredError), _knocking: knocking, _lobbyChatMessages: messages, _lobbyMessageRecipient: lobbyMessageRecipient?.name, diff --git a/react/features/lobby/components/web/LobbyScreen.tsx b/react/features/lobby/components/web/LobbyScreen.tsx index 790da31f54c95..fd5a4b985d961 100644 --- a/react/features/lobby/components/web/LobbyScreen.tsx +++ b/react/features/lobby/components/web/LobbyScreen.tsx @@ -154,19 +154,21 @@ class LobbyScreen extends AbstractLobbyScreen { _renderParticipantInfo() { const { displayName } = this.state; const { _isDisplayNameRequiredActive, t } = this.props; + const showError = _isDisplayNameRequiredActive && !displayName; return ( <> - {_isDisplayNameRequiredActive &&
{t('prejoin.errorMissingName')}
} diff --git a/react/features/lobby/middleware.ts b/react/features/lobby/middleware.ts index 48e23d8ebc085..8da1c725a0cf4 100644 --- a/react/features/lobby/middleware.ts +++ b/react/features/lobby/middleware.ts @@ -267,7 +267,7 @@ function _conferenceFailed({ dispatch, getState }: IStore, next: Function, actio const state = getState(); const { membersOnly } = state['features/base/conference']; const nonFirstFailure = Boolean(membersOnly); - const { isDisplayNameRequired } = state['features/lobby']; + const { isDisplayNameRequiredError } = state['features/lobby']; const { prejoinConfig } = state['features/base/config']; if (error.name === JitsiConferenceErrors.MEMBERS_ONLY_ERROR) { @@ -280,7 +280,7 @@ function _conferenceFailed({ dispatch, getState }: IStore, next: Function, actio dispatch(openLobbyScreen()); // if there was an error about display name and pre-join is not enabled - if (shouldAutoKnock(state) || (isDisplayNameRequired && !prejoinConfig?.enabled)) { + if (shouldAutoKnock(state) || (isDisplayNameRequiredError && !prejoinConfig?.enabled)) { dispatch(startKnocking()); } diff --git a/react/features/lobby/reducer.ts b/react/features/lobby/reducer.ts index 01c6255d65d35..d225a72fa282e 100644 --- a/react/features/lobby/reducer.ts +++ b/react/features/lobby/reducer.ts @@ -12,6 +12,7 @@ import { KNOCKING_PARTICIPANT_LEFT, REMOVE_LOBBY_CHAT_WITH_MODERATOR, SET_KNOCKING_STATE, + SET_LOBBY_DISPLAY_NAME_REQUIRED, SET_LOBBY_MODE_ENABLED, SET_LOBBY_PARTICIPANT_CHAT_STATE, SET_LOBBY_VISIBILITY, @@ -21,6 +22,7 @@ import { IKnockingParticipant } from './types'; const DEFAULT_STATE = { isDisplayNameRequired: false, + isDisplayNameRequiredError: false, knocking: false, knockingParticipants: [], lobbyEnabled: false, @@ -29,7 +31,18 @@ const DEFAULT_STATE = { }; export interface ILobbyState { + + /** + * The required display name is coming from jiconop informing the lobby is enabled, + * and we should require a display name in UI before even trying to join. + */ isDisplayNameRequired: boolean; + + /** + * A conference error when we tried to join into a room with no display name + * when lobby is enabled in the room. + */ + isDisplayNameRequiredError: boolean; knocking: boolean; knockingParticipants: IKnockingParticipant[]; lobbyEnabled: boolean; @@ -51,7 +64,7 @@ ReducerRegistry.register('features/lobby', (state = DEFAULT_STATE, if (action.error.name === JitsiConferenceErrors.DISPLAY_NAME_REQUIRED) { return { ...state, - isDisplayNameRequired: true + isDisplayNameRequiredError: true }; } @@ -77,6 +90,11 @@ ReducerRegistry.register('features/lobby', (state = DEFAULT_STATE, knocking: action.knocking, passwordJoinFailed: false }; + case SET_LOBBY_DISPLAY_NAME_REQUIRED: + return { + ...state, + isDisplayNameRequired: true + }; case SET_LOBBY_MODE_ENABLED: return { ...state, diff --git a/react/features/prejoin/actionTypes.ts b/react/features/prejoin/actionTypes.ts index e4bb715752cbb..97c6e07642bc9 100644 --- a/react/features/prejoin/actionTypes.ts +++ b/react/features/prejoin/actionTypes.ts @@ -19,11 +19,6 @@ export const SET_DEVICE_STATUS = 'SET_DEVICE_STATUS'; */ export const SET_SKIP_PREJOIN_RELOAD = 'SET_SKIP_PREJOIN_RELOAD'; -/** - * Action type used to set the mandatory stance of the prejoin display name. - */ -export const SET_PREJOIN_DISPLAY_NAME_REQUIRED = 'SET_PREJOIN_DISPLAY_NAME_REQUIRED'; - /** * Action type to set the country to dial out to. */ diff --git a/react/features/prejoin/actions.any.ts b/react/features/prejoin/actions.any.ts deleted file mode 100644 index 393553c3ee546..0000000000000 --- a/react/features/prejoin/actions.any.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { - SET_PREJOIN_DISPLAY_NAME_REQUIRED -} from './actionTypes'; - -/** - * Action used to set the stance of the display name. - * - * @returns {Object} - */ -export function setPrejoinDisplayNameRequired() { - return { - type: SET_PREJOIN_DISPLAY_NAME_REQUIRED - }; -} diff --git a/react/features/prejoin/actions.native.ts b/react/features/prejoin/actions.native.ts index ad0295603cd82..af074375488a9 100644 --- a/react/features/prejoin/actions.native.ts +++ b/react/features/prejoin/actions.native.ts @@ -1,4 +1,3 @@ -// we need for using joinConference from actions.web in actions.any in lobby feature import { IStore } from '../app/types'; /** diff --git a/react/features/prejoin/actions.web.ts b/react/features/prejoin/actions.web.ts index 201699410079f..fa10c8396c69b 100644 --- a/react/features/prejoin/actions.web.ts +++ b/react/features/prejoin/actions.web.ts @@ -66,8 +66,6 @@ const STATUS_REQ_FREQUENCY = 2000; */ const STATUS_REQ_CAP = 45; -export * from './actions.any'; - /** * Polls for status change after dial out. * Changes dialog message based on response, closes the dialog if there is an error, diff --git a/react/features/prejoin/components/web/Prejoin.tsx b/react/features/prejoin/components/web/Prejoin.tsx index bcc379a83ffc5..8cf2b593a34c2 100644 --- a/react/features/prejoin/components/web/Prejoin.tsx +++ b/react/features/prejoin/components/web/Prejoin.tsx @@ -452,7 +452,8 @@ const Prejoin = ({ */ function mapStateToProps(state: IReduxState) { const name = getDisplayName(state); - const showErrorOnJoin = isDisplayNameRequired(state) && !name; + const showErrorOnJoin = (isDisplayNameRequired(state) || state['features/lobby'].isDisplayNameRequiredError) + && !name; const { id: participantId } = getLocalParticipant(state) ?? {}; const { joiningInProgress } = state['features/prejoin']; const { room } = state['features/base/conference']; diff --git a/react/features/prejoin/functions.ts b/react/features/prejoin/functions.ts index 396853155cd35..e080d2e1ef047 100644 --- a/react/features/prejoin/functions.ts +++ b/react/features/prejoin/functions.ts @@ -35,7 +35,7 @@ export function isDeviceStatusVisible(state: IReduxState): boolean { * @returns {boolean} */ export function isDisplayNameRequired(state: IReduxState): boolean { - return Boolean(state['features/prejoin']?.isDisplayNameRequired + return Boolean(state['features/lobby']?.isDisplayNameRequired || state['features/base/config']?.requireDisplayName); } diff --git a/react/features/prejoin/reducer.ts b/react/features/prejoin/reducer.ts index f78e5e66f0e82..6d61d0bb5e82e 100644 --- a/react/features/prejoin/reducer.ts +++ b/react/features/prejoin/reducer.ts @@ -1,5 +1,3 @@ -import { CONFERENCE_FAILED } from '../base/conference/actionTypes'; -import { JitsiConferenceErrors } from '../base/lib-jitsi-meet'; import PersistenceRegistry from '../base/redux/PersistenceRegistry'; import ReducerRegistry from '../base/redux/ReducerRegistry'; @@ -12,7 +10,6 @@ import { SET_JOIN_BY_PHONE_DIALOG_VISIBLITY, SET_PRECALL_TEST_RESULTS, SET_PREJOIN_DEVICE_ERRORS, - SET_PREJOIN_DISPLAY_NAME_REQUIRED, SET_PREJOIN_PAGE_VISIBILITY, SET_SKIP_PREJOIN_RELOAD } from './actionTypes'; @@ -28,7 +25,6 @@ const DEFAULT_STATE = { }, dialOutNumber: '', dialOutStatus: 'prejoin.dialing', - isDisplayNameRequired: false, name: '', rawError: '', showPrejoin: true, @@ -47,7 +43,6 @@ export interface IPrejoinState { }; dialOutNumber: string; dialOutStatus: string; - isDisplayNameRequired: boolean; joiningInProgress?: boolean; name: string; precallTestResults?: { @@ -74,16 +69,6 @@ PersistenceRegistry.register('features/prejoin', { ReducerRegistry.register( 'features/prejoin', (state = DEFAULT_STATE, action): IPrejoinState => { switch (action.type) { - case CONFERENCE_FAILED: { - if (action.error.name === JitsiConferenceErrors.DISPLAY_NAME_REQUIRED) { - return { - ...state, - isDisplayNameRequired: true - }; - } - - return state; - } case PREJOIN_JOINING_IN_PROGRESS: return { ...state, @@ -155,13 +140,6 @@ ReducerRegistry.register( }; } - case SET_PREJOIN_DISPLAY_NAME_REQUIRED: { - return { - ...state, - isDisplayNameRequired: true - }; - } - default: return state; } From 33ecd109152434f48a879245ce4530792da5ff69 Mon Sep 17 00:00:00 2001 From: damencho Date: Wed, 19 Jul 2023 12:52:41 -0500 Subject: [PATCH 5/5] squash: Drops unused isDisplayNameRequired. This was used on showing prejoin when connection was established on showing prejoin. We no longer establish it at that time, so it is not possible to hit it and act on it. --- react/features/base/connection/actions.any.ts | 10 ---------- react/features/lobby/actionTypes.ts | 5 ----- react/features/lobby/actions.any.ts | 11 ----------- react/features/lobby/reducer.ts | 13 ------------- react/features/prejoin/components/web/Prejoin.tsx | 3 +-- react/features/prejoin/functions.ts | 2 +- 6 files changed, 2 insertions(+), 42 deletions(-) diff --git a/react/features/base/connection/actions.any.ts b/react/features/base/connection/actions.any.ts index d2bc27cc31fee..07121bef2900a 100644 --- a/react/features/base/connection/actions.any.ts +++ b/react/features/base/connection/actions.any.ts @@ -1,7 +1,6 @@ import _ from 'lodash'; import { IReduxState, IStore } from '../../app/types'; -import { setLobbyDisplayNameRequired } from '../../lobby/actions'; import { conferenceLeft, conferenceWillLeave } from '../conference/actions'; import { getCurrentConference } from '../conference/functions'; import JitsiMeetJS, { JitsiConnectionEvents } from '../lib-jitsi-meet'; @@ -232,15 +231,6 @@ export function _connectInternal(id?: string, password?: string) { JitsiConnectionEvents.CONNECTION_FAILED, _onConnectionFailed); - /** - * Marks the display name for the lobby/prejoin screen as required. - * This can happen if a user tries to join a room with lobby enabled and no display name set. - */ - connection.addEventListener( - JitsiConnectionEvents.DISPLAY_NAME_REQUIRED, - () => dispatch(setLobbyDisplayNameRequired()) - ); - /** * Unsubscribe the connection instance from * {@code CONNECTION_DISCONNECTED} and {@code CONNECTION_FAILED} events. diff --git a/react/features/lobby/actionTypes.ts b/react/features/lobby/actionTypes.ts index 1460d427031aa..99073bdf37780 100644 --- a/react/features/lobby/actionTypes.ts +++ b/react/features/lobby/actionTypes.ts @@ -28,11 +28,6 @@ export const SET_LOBBY_VISIBILITY = 'TOGGLE_LOBBY_VISIBILITY'; */ export const SET_PASSWORD_JOIN_FAILED = 'SET_PASSWORD_JOIN_FAILED'; -/** - * Action type used to set that the display name on lobby/prejoin screen is manadatory. - */ -export const SET_LOBBY_DISPLAY_NAME_REQUIRED = 'SET_LOBBY_DISPLAY_NAME_REQUIRED'; - /** * Action type to set a lobby chat participant's state to chatting */ diff --git a/react/features/lobby/actions.any.ts b/react/features/lobby/actions.any.ts index 956a4f672366c..f5846b29daf84 100644 --- a/react/features/lobby/actions.any.ts +++ b/react/features/lobby/actions.any.ts @@ -15,7 +15,6 @@ import { KNOCKING_PARTICIPANT_LEFT, REMOVE_LOBBY_CHAT_WITH_MODERATOR, SET_KNOCKING_STATE, - SET_LOBBY_DISPLAY_NAME_REQUIRED, SET_LOBBY_MODE_ENABLED, SET_LOBBY_PARTICIPANT_CHAT_STATE, SET_LOBBY_VISIBILITY, @@ -421,13 +420,3 @@ export function setLobbyMessageListener() { }; } -/** - * Action used to set the stance of the display name. - * - * @returns {Object} - */ -export function setLobbyDisplayNameRequired() { - return { - type: SET_LOBBY_DISPLAY_NAME_REQUIRED - }; -} diff --git a/react/features/lobby/reducer.ts b/react/features/lobby/reducer.ts index d225a72fa282e..6aa5105b086a7 100644 --- a/react/features/lobby/reducer.ts +++ b/react/features/lobby/reducer.ts @@ -12,7 +12,6 @@ import { KNOCKING_PARTICIPANT_LEFT, REMOVE_LOBBY_CHAT_WITH_MODERATOR, SET_KNOCKING_STATE, - SET_LOBBY_DISPLAY_NAME_REQUIRED, SET_LOBBY_MODE_ENABLED, SET_LOBBY_PARTICIPANT_CHAT_STATE, SET_LOBBY_VISIBILITY, @@ -21,7 +20,6 @@ import { import { IKnockingParticipant } from './types'; const DEFAULT_STATE = { - isDisplayNameRequired: false, isDisplayNameRequiredError: false, knocking: false, knockingParticipants: [], @@ -32,12 +30,6 @@ const DEFAULT_STATE = { export interface ILobbyState { - /** - * The required display name is coming from jiconop informing the lobby is enabled, - * and we should require a display name in UI before even trying to join. - */ - isDisplayNameRequired: boolean; - /** * A conference error when we tried to join into a room with no display name * when lobby is enabled in the room. @@ -90,11 +82,6 @@ ReducerRegistry.register('features/lobby', (state = DEFAULT_STATE, knocking: action.knocking, passwordJoinFailed: false }; - case SET_LOBBY_DISPLAY_NAME_REQUIRED: - return { - ...state, - isDisplayNameRequired: true - }; case SET_LOBBY_MODE_ENABLED: return { ...state, diff --git a/react/features/prejoin/components/web/Prejoin.tsx b/react/features/prejoin/components/web/Prejoin.tsx index 8cf2b593a34c2..bcc379a83ffc5 100644 --- a/react/features/prejoin/components/web/Prejoin.tsx +++ b/react/features/prejoin/components/web/Prejoin.tsx @@ -452,8 +452,7 @@ const Prejoin = ({ */ function mapStateToProps(state: IReduxState) { const name = getDisplayName(state); - const showErrorOnJoin = (isDisplayNameRequired(state) || state['features/lobby'].isDisplayNameRequiredError) - && !name; + const showErrorOnJoin = isDisplayNameRequired(state) && !name; const { id: participantId } = getLocalParticipant(state) ?? {}; const { joiningInProgress } = state['features/prejoin']; const { room } = state['features/base/conference']; diff --git a/react/features/prejoin/functions.ts b/react/features/prejoin/functions.ts index e080d2e1ef047..fd10399aeabe3 100644 --- a/react/features/prejoin/functions.ts +++ b/react/features/prejoin/functions.ts @@ -35,7 +35,7 @@ export function isDeviceStatusVisible(state: IReduxState): boolean { * @returns {boolean} */ export function isDisplayNameRequired(state: IReduxState): boolean { - return Boolean(state['features/lobby']?.isDisplayNameRequired + return Boolean(state['features/lobby']?.isDisplayNameRequiredError || state['features/base/config']?.requireDisplayName); }