Skip to content

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

fix(follow-me): Moves follow-me state to its feature.

damenchoc5f82d4f20a6
diff --git a/modules/API/API.js b/modules/API/API.js
index eed8debe90..dfea86900d 100755
--- a/modules/API/API.js
+++ b/modules/API/API.js
@@ -19,8 +19,6 @@ import {
endConference,
sendTones,
setAssumedBandwidthBps,
- setFollowMe,
- setFollowMeRecorder,
setLocalSubject,
setPassword,
setSubject
@@ -91,6 +89,7 @@ import {
togglePinStageParticipant
} from '../../react/features/filmstrip/actions.web';
import { getPinnedActiveParticipants, isStageFilmstripAvailable } from '../../react/features/filmstrip/functions.web';
+import { setFollowMe, setFollowMeRecorder } from '../../react/features/follow-me/actions';
import { invite } from '../../react/features/invite/actions.any';
import {
selectParticipantInLargeVideo
diff --git a/react/features/base/conference/actionTypes.ts b/react/features/base/conference/actionTypes.ts
index 4e4c7a140a..4b73da9401 100644
--- a/react/features/base/conference/actionTypes.ts
+++ b/react/features/base/conference/actionTypes.ts
@@ -260,28 +260,6 @@ export const P2P_STATUS_CHANGED = 'P2P_STATUS_CHANGED';
*/
export const SEND_TONES = 'SEND_TONES';
-/**
- * The type of (redux) action which updates the current known status of the
- * Follow Me feature.
- *
- * {
- * type: SET_FOLLOW_ME,
- * enabled: boolean
- * }
- */
-export const SET_FOLLOW_ME = 'SET_FOLLOW_ME';
-
-/**
- * The type of (redux) action which updates the current known status of the
- * Follow Me feature that is used only by the recorder.
- *
- * {
- * type: SET_FOLLOW_ME_RECORDER,
- * enabled: boolean
- * }
- */
-export const SET_FOLLOW_ME_RECORDER = 'SET_FOLLOW_ME_RECORDER';
-
/**
* The type of (redux) action which sets the obfuscated room name.
*
diff --git a/react/features/base/conference/actions.any.ts b/react/features/base/conference/actions.any.ts
index ddec6cf624..077febb8f3 100644
--- a/react/features/base/conference/actions.any.ts
+++ b/react/features/base/conference/actions.any.ts
@@ -58,8 +58,6 @@ import {
P2P_STATUS_CHANGED,
SEND_TONES,
SET_ASSUMED_BANDWIDTH_BPS,
- SET_FOLLOW_ME,
- SET_FOLLOW_ME_RECORDER,
SET_OBFUSCATED_ROOM,
SET_PASSWORD,
SET_PASSWORD_FAILED,
@@ -853,38 +851,6 @@ export function sendTones(tones: string, duration: number, pause: number) {
};
}
-/**
- * Enables or disables the Follow Me feature.
- *
- * @param {boolean} enabled - Whether or not Follow Me should be enabled.
- * @returns {{
- * type: SET_FOLLOW_ME,
- * enabled: boolean
- * }}
- */
-export function setFollowMe(enabled: boolean) {
- return {
- type: SET_FOLLOW_ME,
- enabled
- };
-}
-
-/**
- * Enables or disables the Follow Me feature used only for the recorder.
- *
- * @param {boolean} enabled - Whether Follow Me should be enabled and used only by the recorder.
- * @returns {{
- * type: SET_FOLLOW_ME_RECORDER,
- * enabled: boolean
- * }}
- */
-export function setFollowMeRecorder(enabled: boolean) {
- return {
- type: SET_FOLLOW_ME_RECORDER,
- enabled
- };
-}
-
/**
* Enables or disables the Mute reaction sounds feature.
*
diff --git a/react/features/base/conference/reducer.ts b/react/features/base/conference/reducer.ts
index 99c8ce1bde..44e62fa9a2 100644
--- a/react/features/base/conference/reducer.ts
+++ b/react/features/base/conference/reducer.ts
@@ -26,8 +26,6 @@ import {
LOCK_STATE_CHANGED,
P2P_STATUS_CHANGED,
SET_ASSUMED_BANDWIDTH_BPS,
- SET_FOLLOW_ME,
- SET_FOLLOW_ME_RECORDER,
SET_OBFUSCATED_ROOM,
SET_PASSWORD,
SET_PENDING_SUBJECT_CHANGE,
@@ -178,8 +176,6 @@ export interface IConferenceState {
dataChannelOpen?: boolean;
e2eeSupported?: boolean;
error?: Error;
- followMeEnabled?: boolean;
- followMeRecorderEnabled?: boolean;
joining?: IJitsiConference;
leaving?: IJitsiConference;
lobbyError?: boolean;
@@ -274,14 +270,6 @@ ReducerRegistry.register<IConferenceState>('features/base/conference',
return set(state, 'assumedBandwidthBps', assumedBandwidthBps);
}
- case SET_FOLLOW_ME:
- return set(state, 'followMeEnabled', action.enabled);
-
- case SET_FOLLOW_ME_RECORDER:
- return { ...state,
- followMeRecorderEnabled: action.enabled,
- followMeEnabled: action.enabled
- };
case SET_START_REACTIONS_MUTED:
return set(state, 'startReactionsMuted', action.muted);
diff --git a/react/features/follow-me/actionTypes.ts b/react/features/follow-me/actionTypes.ts
index 1e30d1aeba..7a0dd7ca70 100644
--- a/react/features/follow-me/actionTypes.ts
+++ b/react/features/follow-me/actionTypes.ts
@@ -19,3 +19,25 @@ export const SET_FOLLOW_ME_MODERATOR = 'SET_FOLLOW_ME_MODERATOR';
* }
*/
export const SET_FOLLOW_ME_STATE = 'SET_FOLLOW_ME_STATE';
+
+/**
+ * The type of (redux) action which updates the current known status of the
+ * Follow Me feature.
+ *
+ * {
+ * type: SET_FOLLOW_ME,
+ * enabled: boolean
+ * }
+ */
+export const SET_FOLLOW_ME = 'SET_FOLLOW_ME';
+
+/**
+ * The type of (redux) action which updates the current known status of the
+ * Follow Me feature that is used only by the recorder.
+ *
+ * {
+ * type: SET_FOLLOW_ME_RECORDER,
+ * enabled: boolean
+ * }
+ */
+export const SET_FOLLOW_ME_RECORDER = 'SET_FOLLOW_ME_RECORDER';
diff --git a/react/features/follow-me/actions.ts b/react/features/follow-me/actions.ts
index 2e6e0267c4..897d28e166 100644
--- a/react/features/follow-me/actions.ts
+++ b/react/features/follow-me/actions.ts
@@ -1,5 +1,7 @@
import {
+ SET_FOLLOW_ME,
SET_FOLLOW_ME_MODERATOR,
+ SET_FOLLOW_ME_RECORDER,
SET_FOLLOW_ME_STATE
} from './actionTypes';
@@ -37,3 +39,35 @@ export function setFollowMeState(state?: Object) {
state
};
}
+
+/**
+ * Enables or disables the Follow Me feature.
+ *
+ * @param {boolean} enabled - Whether or not Follow Me should be enabled.
+ * @returns {{
+ * type: SET_FOLLOW_ME,
+ * enabled: boolean
+ * }}
+ */
+export function setFollowMe(enabled: boolean) {
+ return {
+ type: SET_FOLLOW_ME,
+ enabled
+ };
+}
+
+/**
+ * Enables or disables the Follow Me feature used only for the recorder.
+ *
+ * @param {boolean} enabled - Whether Follow Me should be enabled and used only by the recorder.
+ * @returns {{
+ * type: SET_FOLLOW_ME_RECORDER,
+ * enabled: boolean
+ * }}
+ */
+export function setFollowMeRecorder(enabled: boolean) {
+ return {
+ type: SET_FOLLOW_ME_RECORDER,
+ enabled
+ };
+}
diff --git a/react/features/follow-me/reducer.ts b/react/features/follow-me/reducer.ts
index 4697879578..802bc2d886 100644
--- a/react/features/follow-me/reducer.ts
+++ b/react/features/follow-me/reducer.ts
@@ -2,11 +2,15 @@ import ReducerRegistry from '../base/redux/ReducerRegistry';
import { set } from '../base/redux/functions';
import {
+ SET_FOLLOW_ME,
SET_FOLLOW_ME_MODERATOR,
+ SET_FOLLOW_ME_RECORDER,
SET_FOLLOW_ME_STATE
} from './actionTypes';
export interface IFollowMeState {
+ followMeEnabled?: boolean;
+ followMeRecorderEnabled?: boolean;
moderator?: string;
recorder?: boolean;
state?: {
@@ -21,7 +25,8 @@ ReducerRegistry.register<IFollowMeState>(
'features/follow-me',
(state = {}, action): IFollowMeState => {
switch (action.type) {
-
+ case SET_FOLLOW_ME:
+ return set(state, 'followMeEnabled', action.enabled);
case SET_FOLLOW_ME_MODERATOR: {
let newState = set(state, 'moderator', action.id);
@@ -35,6 +40,11 @@ ReducerRegistry.register<IFollowMeState>(
return newState;
}
+ case SET_FOLLOW_ME_RECORDER:
+ return { ...state,
+ followMeRecorderEnabled: action.enabled,
+ followMeEnabled: action.enabled
+ };
case SET_FOLLOW_ME_STATE: {
return set(state, 'state', action.state);
}
diff --git a/react/features/follow-me/subscriber.ts b/react/features/follow-me/subscriber.ts
index 78a2592b8d..9d1d76378d 100644
--- a/react/features/follow-me/subscriber.ts
+++ b/react/features/follow-me/subscriber.ts
@@ -17,7 +17,7 @@ import { FOLLOW_ME_COMMAND } from './constants';
* notify all listeners.
*/
StateListenerRegistry.register(
- /* selector */ state => state['features/base/conference'].followMeEnabled,
+ /* selector */ state => state['features/follow-me'].followMeEnabled,
/* listener */ (newSelectedValue, store) => _sendFollowMeCommand(newSelectedValue || 'off', store));
/**
@@ -88,7 +88,7 @@ function _getFollowMeState(state: IReduxState) {
const stageFilmstrip = isStageFilmstripEnabled(state);
return {
- recorder: state['features/base/conference'].followMeRecorderEnabled,
+ recorder: state['features/follow-me'].followMeRecorderEnabled,
filmstripVisible: state['features/filmstrip'].visible,
maxStageParticipants: stageFilmstrip ? state['features/base/settings'].maxStageParticipants : undefined,
nextOnStage: pinnedParticipant?.id,
@@ -130,7 +130,7 @@ function _sendFollowMeCommand(
);
return;
- } else if (!state['features/base/conference'].followMeEnabled) {
+ } else if (!state['features/follow-me'].followMeEnabled) {
return;
}
diff --git a/react/features/settings/actions.web.ts b/react/features/settings/actions.web.ts
index a7cc2f9a7f..6807dea6e6 100644
--- a/react/features/settings/actions.web.ts
+++ b/react/features/settings/actions.web.ts
@@ -4,8 +4,6 @@ import { IStore } from '../app/types';
import { setTokenAuthUrlSuccess } from '../authentication/actions.web';
import { isTokenAuthEnabled } from '../authentication/functions';
import {
- setFollowMe,
- setFollowMeRecorder,
setStartMutedPolicy,
setStartReactionsMuted
} from '../base/conference/actions';
@@ -19,6 +17,7 @@ import { updateSettings } from '../base/settings/actions';
import { IAudioSettings } from '../base/settings/reducer';
import { getLocalVideoTrack } from '../base/tracks/functions.web';
import { appendURLHashParam } from '../base/util/uri';
+import { setFollowMe, setFollowMeRecorder } from '../follow-me/actions';
import { disableKeyboardShortcuts, enableKeyboardShortcuts } from '../keyboard-shortcuts/actions';
import { toggleBackgroundEffect } from '../virtual-background/actions';
import virtualBackgroundLogger from '../virtual-background/logger';
diff --git a/react/features/settings/components/native/ModeratorSection.tsx b/react/features/settings/components/native/ModeratorSection.tsx
index 5ca972403a..f8c8e7217d 100644
--- a/react/features/settings/components/native/ModeratorSection.tsx
+++ b/react/features/settings/components/native/ModeratorSection.tsx
@@ -3,13 +3,12 @@ import { useDispatch, useSelector } from 'react-redux';
import { IReduxState } from '../../../app/types';
import {
- setFollowMe,
- setFollowMeRecorder,
setStartMutedPolicy,
setStartReactionsMuted
} from '../../../base/conference/actions';
import { updateSettings } from '../../../base/settings/actions';
import Switch from '../../../base/ui/components/native/Switch';
+import { setFollowMe, setFollowMeRecorder } from '../../../follow-me/actions';
import { getModeratorTabProps } from '../../functions.native';
import FormRow from './FormRow';
diff --git a/react/features/settings/functions.any.ts b/react/features/settings/functions.any.ts
index 106f1f3133..ae826cd281 100644
--- a/react/features/settings/functions.any.ts
+++ b/react/features/settings/functions.any.ts
@@ -151,12 +151,11 @@ export function getModeratorTabProps(stateful: IStateful) {
const state = toState(stateful);
const {
conference,
- followMeEnabled,
- followMeRecorderEnabled,
startAudioMutedPolicy,
startVideoMutedPolicy,
startReactionsMuted
} = state['features/base/conference'];
+ const { followMeEnabled, followMeRecorderEnabled } = state['features/follow-me'];
const { groupChatWithPermissions } = state['features/chat'];
const { disableReactionsModeration } = state['features/base/config'];
const followMeActive = isFollowMeActive(state);