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(recording): check JWT features instead of moderator role for label controls (#17329)

Mihaela Dumitrue7cbb1f4bfca
diff --git a/react/features/recording/components/web/RecordingLabel.tsx b/react/features/recording/components/web/RecordingLabel.tsx
index cbb8c93515..552f46e9a8 100644
--- a/react/features/recording/components/web/RecordingLabel.tsx
+++ b/react/features/recording/components/web/RecordingLabel.tsx
@@ -9,8 +9,8 @@ import { translate } from '../../../base/i18n/functions';
import { IconRecord, IconSites } from '../../../base/icons/svg';
import Label from '../../../base/label/components/web/Label';
import { JitsiRecordingConstants } from '../../../base/lib-jitsi-meet';
-import { isLocalParticipantModerator } from '../../../base/participants/functions';
import Tooltip from '../../../base/tooltip/components/Tooltip';
+import { hasRecordingOrTranscriptionFeature } from '../../functions';
import AbstractRecordingLabel, {
IProps as AbstractProps,
_mapStateToProps as _abstractMapStateToProps
@@ -20,9 +20,9 @@ import StopRecordingDialog from '../Recording/web/StopRecordingDialog';
interface IProps extends AbstractProps {
/**
- * Whether the local participant is a moderator.
+ * Whether the local participant can control recording/transcription (has either feature enabled).
*/
- _isModerator: boolean;
+ _canControlRecording: boolean;
/**
* An object containing the CSS classes.
@@ -75,7 +75,7 @@ class RecordingLabel extends AbstractRecordingLabel<IProps> {
* @returns {void}
*/
_onClick() {
- if (this.props._isModerator) {
+ if (this.props._canControlRecording) {
this.props.dispatch(openDialog('StopRecordingDialog', StopRecordingDialog));
}
}
@@ -124,7 +124,7 @@ class RecordingLabel extends AbstractRecordingLabel<IProps> {
function _mapStateToProps(state: IReduxState, ownProps: any) {
return {
..._abstractMapStateToProps(state, ownProps),
- _isModerator: isLocalParticipantModerator(state)
+ _canControlRecording: hasRecordingOrTranscriptionFeature(state)
};
}
diff --git a/react/features/recording/components/web/TranscribingLabel.tsx b/react/features/recording/components/web/TranscribingLabel.tsx
index 06721a6234..d990b3400f 100644
--- a/react/features/recording/components/web/TranscribingLabel.tsx
+++ b/react/features/recording/components/web/TranscribingLabel.tsx
@@ -8,9 +8,9 @@ import { openDialog } from '../../../base/dialog/actions';
import { translate } from '../../../base/i18n/functions';
import { IconTranscription } from '../../../base/icons/svg';
import Label from '../../../base/label/components/web/Label';
-import { isLocalParticipantModerator } from '../../../base/participants/functions';
import Tooltip from '../../../base/tooltip/components/Tooltip';
import { isRecorderTranscriptionsRunning } from '../../../transcribing/functions';
+import { hasRecordingOrTranscriptionFeature } from '../../functions';
import AbstractRecordingLabel, {
IProps as AbstractProps
} from '../AbstractRecordingLabel';
@@ -19,9 +19,9 @@ import StopRecordingDialog from '../Recording/web/StopRecordingDialog';
interface IProps extends AbstractProps {
/**
- * Whether the local participant is a moderator.
+ * Whether the local participant can control recording/transcription (has either feature enabled).
*/
- _isModerator: boolean;
+ _canControlRecording: boolean;
/**
* An object containing the CSS classes.
@@ -74,7 +74,7 @@ class TranscribingLabel extends AbstractRecordingLabel<IProps> {
* @returns {void}
*/
_onClick() {
- if (this.props._isModerator) {
+ if (this.props._canControlRecording) {
this.props.dispatch(openDialog('StopRecordingDialog', StopRecordingDialog));
}
}
@@ -120,7 +120,7 @@ function _mapStateToProps(state: IReduxState) {
return {
_isVisible: _isTranscribing,
_iAmRecorder: Boolean(state['features/base/config'].iAmRecorder),
- _isModerator: isLocalParticipantModerator(state),
+ _canControlRecording: hasRecordingOrTranscriptionFeature(state),
_isTranscribing,
mode: 'transcribing' // Custom mode for transcription
};
diff --git a/react/features/recording/functions.ts b/react/features/recording/functions.ts
index 995e49ba47..7855296266 100644
--- a/react/features/recording/functions.ts
+++ b/react/features/recording/functions.ts
@@ -197,6 +197,18 @@ export function isRecordingRunning(state: IReduxState) {
);
}
+/**
+ * Returns true if the participant has either the recording or transcription JWT feature enabled.
+ * Used to determine if the user can interact with recording/transcription controls.
+ *
+ * @param {Object} state - The redux state to search in.
+ * @returns {boolean}
+ */
+export function hasRecordingOrTranscriptionFeature(state: IReduxState) {
+ return isJwtFeatureEnabled(state, MEET_FEATURES.RECORDING, false)
+ || isJwtFeatureEnabled(state, MEET_FEATURES.TRANSCRIPTION, false);
+}
+
/**
* Returns true if the participant can stop recording.
*
@@ -209,8 +221,7 @@ export function canStopRecording(state: IReduxState) {
}
if (isCloudRecordingRunning(state) || isRecorderTranscriptionsRunning(state)) {
- return isJwtFeatureEnabled(state, MEET_FEATURES.RECORDING, false)
- || isJwtFeatureEnabled(state, MEET_FEATURES.TRANSCRIPTION, false);
+ return hasRecordingOrTranscriptionFeature(state);
}
return false;