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(replace-participant): Add replaceParticipant feature-flag

tmoldovan8x80bd45a75d2d8
diff --git a/conference.js b/conference.js
index 27bea0ab6e..d1f70e4e11 100644
--- a/conference.js
+++ b/conference.js
@@ -45,6 +45,7 @@ import {
p2pStatusChanged,
sendLocalParticipant
} from './react/features/base/conference';
+import { getReplaceParticipant } from './react/features/base/config/functions';
import {
checkAndNotifyForNewDevice,
getAvailableDevices,
@@ -304,9 +305,8 @@ class ConferenceConnector {
// not enough rights to create conference
case JitsiConferenceErrors.AUTHENTICATION_REQUIRED: {
- const { replaceParticipant }
- = APP.store.getState()['features/base/config'];
+ const replaceParticipant = getReplaceParticipant(APP.store.getState());
// Schedule reconnect to check if someone else created the room.
this.reconnectTimeout = setTimeout(() => {
@@ -397,7 +397,7 @@ class ConferenceConnector {
*
*/
connect() {
- const { replaceParticipant } = APP.store.getState()['features/base/config'];
+ const replaceParticipant = getReplaceParticipant(APP.store.getState());
// the local storage overrides here and in connection.js can be used by jibri
room.join(jitsiLocalStorage.getItem('xmpp_conference_password_override'), replaceParticipant);
diff --git a/modules/UI/authentication/AuthHandler.js b/modules/UI/authentication/AuthHandler.js
index 24c1de6941..e459184cf9 100644
--- a/modules/UI/authentication/AuthHandler.js
+++ b/modules/UI/authentication/AuthHandler.js
@@ -11,6 +11,7 @@ import {
isTokenAuthEnabled,
getTokenAuthUrl
} from '../../../react/features/authentication/functions';
+import { getReplaceParticipant } from '../../../react/features/base/config/functions';
import { isDialogOpen } from '../../../react/features/base/dialog';
import { setJWT } from '../../../react/features/base/jwt';
import UIUtil from '../util/UIUtil';
@@ -209,8 +210,7 @@ function logout(room: Object) {
}).then(url => {
// de-authenticate conference on the fly
if (room.isJoined()) {
- const { replaceParticipant }
- = APP.store.getState()['features/base/config'];
+ const replaceParticipant = getReplaceParticipant(APP.store.getState());
room.join(null, replaceParticipant);
}
diff --git a/react/features/base/conference/actions.js b/react/features/base/conference/actions.js
index 8d7eb3c1c2..711e646a9a 100644
--- a/react/features/base/conference/actions.js
+++ b/react/features/base/conference/actions.js
@@ -8,6 +8,7 @@ import {
} from '../../analytics';
import { getName } from '../../app/functions';
import { endpointMessageReceived } from '../../subtitles';
+import { getReplaceParticipant } from '../config/functions';
import { JITSI_CONNECTION_CONFERENCE_KEY } from '../connection';
import { JitsiConferenceEvents } from '../lib-jitsi-meet';
import { MEDIA_TYPE, setAudioMuted, setVideoMuted } from '../media';
@@ -460,7 +461,9 @@ export function createConference() {
sendLocalParticipant(state, conference);
- conference.join(password, config.replaceParticipant);
+ const replaceParticipant = getReplaceParticipant(state);
+
+ conference.join(password, replaceParticipant);
};
}
@@ -477,8 +480,7 @@ export function checkIfCanJoin() {
const { authRequired, password }
= getState()['features/base/conference'];
- const { replaceParticipant }
- = getState()['features/base/config'];
+ const replaceParticipant = getReplaceParticipant(APP.store.getState());
authRequired && dispatch(_conferenceWillJoin(authRequired));
authRequired && authRequired.join(password, replaceParticipant);
diff --git a/react/features/base/config/functions.native.js b/react/features/base/config/functions.native.js
index 8f17a5d45f..8b785fb337 100644
--- a/react/features/base/config/functions.native.js
+++ b/react/features/base/config/functions.native.js
@@ -2,6 +2,8 @@
import { NativeModules } from 'react-native';
+import { getFeatureFlag, REPLACE_PARTICIPANT } from '../flags';
+
export * from './functions.any';
/**
@@ -19,3 +21,13 @@ export function _cleanupConfig(config: Object) {
delete config.callStatsSecret;
}
}
+
+/**
+ * Returns the replaceParticipant config.
+ *
+ * @param {Object} state - The state of the app.
+ * @returns {boolean}
+ */
+export function getReplaceParticipant(state: Object): string {
+ return getFeatureFlag(state, REPLACE_PARTICIPANT, false);
+}
diff --git a/react/features/base/config/functions.web.js b/react/features/base/config/functions.web.js
index f411373c93..224d4f5b0e 100644
--- a/react/features/base/config/functions.web.js
+++ b/react/features/base/config/functions.web.js
@@ -33,6 +33,16 @@ export function getDialOutUrl(state: Object): string {
return state['features/base/config'].guestDialOutUrl;
}
+/**
+ * Returns the replaceParticipant config.
+ *
+ * @param {Object} state - The state of the app.
+ * @returns {boolean}
+ */
+export function getReplaceParticipant(state: Object): string {
+ return state['features/base/config'].replaceParticipant;
+}
+
/**
* Returns the list of enabled toolbar buttons.
*
diff --git a/react/features/base/flags/constants.js b/react/features/base/flags/constants.js
index 8e6deba521..692b27d8e8 100644
--- a/react/features/base/flags/constants.js
+++ b/react/features/base/flags/constants.js
@@ -154,6 +154,12 @@ export const RAISE_HAND_ENABLED = 'raise-hand.enabled';
*/
export const RECORDING_ENABLED = 'recording.enabled';
+/**
+ * Flag indicating if the user should join the conference with the replaceParticipant functionality.
+ * Default: (false).
+ */
+export const REPLACE_PARTICIPANT = 'replace.participant';
+
/**
* Flag indicating the local and (maximum) remote video resolution. Overrides
* the server configuration.