Skip to content

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

feat(unsafe-room-name) unify logic

Saúl Ibarra Corretgé6d3ff5a95678
diff --git a/react/features/conference/components/AbstractInsecureRoomNameLabel.tsx b/react/features/conference/components/AbstractInsecureRoomNameLabel.tsx
index f3538dea0f..e6a8996baa 100644
--- a/react/features/conference/components/AbstractInsecureRoomNameLabel.tsx
+++ b/react/features/conference/components/AbstractInsecureRoomNameLabel.tsx
@@ -3,6 +3,7 @@ import { WithTranslation } from 'react-i18next';
import { IReduxState } from '../../app/types';
import isInsecureRoomName from '../../base/util/isInsecureRoomName';
+import { isUnsafeRoomWarningEnabled } from '../../prejoin/functions';
interface IProps extends WithTranslation {
@@ -48,10 +49,9 @@ export default class AbstractInsecureRoomNameLabel extends PureComponent<IProps>
export function _mapStateToProps(state: IReduxState) {
const { locked, room } = state['features/base/conference'];
const { lobbyEnabled } = state['features/lobby'];
- const { enableInsecureRoomNameWarning = false } = state['features/base/config'];
return {
- _visible: Boolean(enableInsecureRoomNameWarning
+ _visible: Boolean(isUnsafeRoomWarningEnabled(state)
&& room && isInsecureRoomName(room)
&& !(lobbyEnabled || Boolean(locked)))
};
diff --git a/react/features/prejoin/components/web/Prejoin.tsx b/react/features/prejoin/components/web/Prejoin.tsx
index bcc379a83f..5b31c93a3d 100644
--- a/react/features/prejoin/components/web/Prejoin.tsx
+++ b/react/features/prejoin/components/web/Prejoin.tsx
@@ -21,6 +21,7 @@ import Button from '../../../base/ui/components/web/Button';
import Input from '../../../base/ui/components/web/Input';
import { BUTTON_TYPES } from '../../../base/ui/constants.any';
import isInsecureRoomName from '../../../base/util/isInsecureRoomName';
+import { isUnsafeRoomWarningEnabled } from '../../../prejoin/functions';
import {
joinConference as joinConferenceAction,
joinConferenceWithoutAudio as joinConferenceWithoutAudioAction,
@@ -456,7 +457,6 @@ function mapStateToProps(state: IReduxState) {
const { id: participantId } = getLocalParticipant(state) ?? {};
const { joiningInProgress } = state['features/prejoin'];
const { room } = state['features/base/conference'];
- const { enableInsecureRoomNameWarning = false } = state['features/base/config'];
const { unsafeRoomConsent } = state['features/base/premeeting'];
return {
@@ -471,7 +471,7 @@ function mapStateToProps(state: IReduxState) {
showCameraPreview: !isVideoMutedByUser(state),
showDialog: isJoinByPhoneDialogVisible(state),
showErrorOnJoin,
- showUnsafeRoomWarning: isInsecureRoomName(room) && enableInsecureRoomNameWarning,
+ showUnsafeRoomWarning: isInsecureRoomName(room) && isUnsafeRoomWarningEnabled(state),
unsafeRoomConsent,
videoTrack: getLocalJitsiVideoTrack(state)
};
diff --git a/react/features/prejoin/functions.ts b/react/features/prejoin/functions.ts
index fd10399aea..a76030aa64 100644
--- a/react/features/prejoin/functions.ts
+++ b/react/features/prejoin/functions.ts
@@ -176,10 +176,11 @@ export function shouldAutoKnock(state: IReduxState): boolean {
/**
* Returns true if the unsafe room warning flag is enabled.
*
- * @param {IReduxState} stateful - The state of the app.
+ * @param {IReduxState} state - The state of the app.
* @returns {boolean}
*/
-export function isUnsafeRoomWarningEnabled(stateful: IReduxState): boolean {
- return Boolean(navigator.product === 'ReactNative'
- && getFeatureFlag(stateful, UNSAFE_ROOM_WARNING, true));
+export function isUnsafeRoomWarningEnabled(state: IReduxState): boolean {
+ const { enableInsecureRoomNameWarning = false } = state['features/base/config'];
+
+ return getFeatureFlag(state, UNSAFE_ROOM_WARNING, enableInsecureRoomNameWarning);
}
diff --git a/react/features/welcome/components/AbstractWelcomePage.ts b/react/features/welcome/components/AbstractWelcomePage.ts
index 2941755b43..a85c4160c7 100644
--- a/react/features/welcome/components/AbstractWelcomePage.ts
+++ b/react/features/welcome/components/AbstractWelcomePage.ts
@@ -10,6 +10,7 @@ import { IReduxState, IStore } from '../../app/types';
import { IDeeplinkingConfig } from '../../base/config/configType';
import isInsecureRoomName from '../../base/util/isInsecureRoomName';
import { isCalendarEnabled } from '../../calendar-sync/functions';
+import { isUnsafeRoomWarningEnabled } from '../../prejoin/functions';
import { isRecentListEnabled } from '../../recent-list/functions';
/**
@@ -288,7 +289,7 @@ export function _mapStateToProps(state: IReduxState) {
return {
_calendarEnabled: isCalendarEnabled(state),
_deeplinkingCfg: state['features/base/config'].deeplinking || {},
- _enableInsecureRoomNameWarning: state['features/base/config'].enableInsecureRoomNameWarning || false,
+ _enableInsecureRoomNameWarning: isUnsafeRoomWarningEnabled(state),
_moderatedRoomServiceUrl: state['features/base/config'].moderatedRoomServiceUrl,
_recentListEnabled: isRecentListEnabled(),
_room: state['features/base/conference'].room ?? '',