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): restrict stop recording dialog to moderators (#17328)

Mihaela Dumitru9604f0ff199e
diff --git a/react/features/recording/components/web/RecordingLabel.tsx b/react/features/recording/components/web/RecordingLabel.tsx
index 3a444e8db1..cbb8c93515 100644
--- a/react/features/recording/components/web/RecordingLabel.tsx
+++ b/react/features/recording/components/web/RecordingLabel.tsx
@@ -3,21 +3,27 @@ import React from 'react';
import { connect } from 'react-redux';
import { withStyles } from 'tss-react/mui';
-import { IStore } from '../../../app/types';
+import { IReduxState, IStore } from '../../../app/types';
import { openDialog } from '../../../base/dialog/actions';
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 AbstractRecordingLabel, {
IProps as AbstractProps,
- _mapStateToProps
+ _mapStateToProps as _abstractMapStateToProps
} from '../AbstractRecordingLabel';
import StopRecordingDialog from '../Recording/web/StopRecordingDialog';
interface IProps extends AbstractProps {
+ /**
+ * Whether the local participant is a moderator.
+ */
+ _isModerator: boolean;
+
/**
* An object containing the CSS classes.
*/
@@ -69,7 +75,9 @@ class RecordingLabel extends AbstractRecordingLabel<IProps> {
* @returns {void}
*/
_onClick() {
- this.props.dispatch(openDialog('StopRecordingDialog', StopRecordingDialog));
+ if (this.props._isModerator) {
+ this.props.dispatch(openDialog('StopRecordingDialog', StopRecordingDialog));
+ }
}
/**
@@ -105,4 +113,19 @@ class RecordingLabel extends AbstractRecordingLabel<IProps> {
}
}
+/**
+ * Maps (parts of) the Redux state to the associated props.
+ *
+ * @param {Object} state - The Redux state.
+ * @param {Object} ownProps - The component's own props.
+ * @private
+ * @returns {Object}
+ */
+function _mapStateToProps(state: IReduxState, ownProps: any) {
+ return {
+ ..._abstractMapStateToProps(state, ownProps),
+ _isModerator: isLocalParticipantModerator(state)
+ };
+}
+
export default withStyles(translate(connect(_mapStateToProps)(RecordingLabel)), styles);
diff --git a/react/features/recording/components/web/TranscribingLabel.tsx b/react/features/recording/components/web/TranscribingLabel.tsx
index d6ef4e1268..06721a6234 100644
--- a/react/features/recording/components/web/TranscribingLabel.tsx
+++ b/react/features/recording/components/web/TranscribingLabel.tsx
@@ -8,6 +8,7 @@ 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 AbstractRecordingLabel, {
@@ -17,6 +18,11 @@ import StopRecordingDialog from '../Recording/web/StopRecordingDialog';
interface IProps extends AbstractProps {
+ /**
+ * Whether the local participant is a moderator.
+ */
+ _isModerator: boolean;
+
/**
* An object containing the CSS classes.
*/
@@ -68,7 +74,9 @@ class TranscribingLabel extends AbstractRecordingLabel<IProps> {
* @returns {void}
*/
_onClick() {
- this.props.dispatch(openDialog('StopRecordingDialog', StopRecordingDialog));
+ if (this.props._isModerator) {
+ this.props.dispatch(openDialog('StopRecordingDialog', StopRecordingDialog));
+ }
}
/**
@@ -112,6 +120,7 @@ function _mapStateToProps(state: IReduxState) {
return {
_isVisible: _isTranscribing,
_iAmRecorder: Boolean(state['features/base/config'].iAmRecorder),
+ _isModerator: isLocalParticipantModerator(state),
_isTranscribing,
mode: 'transcribing' // Custom mode for transcription
};