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) prevent multiple consent requests

Saúl Ibarra Corretgéf6f4ebf18589
diff --git a/react/features/recording/actionTypes.ts b/react/features/recording/actionTypes.ts
index 9c02f12e51..1ab1b91d34 100644
--- a/react/features/recording/actionTypes.ts
+++ b/react/features/recording/actionTypes.ts
@@ -8,6 +8,16 @@
*/
export const CLEAR_RECORDING_SESSIONS = 'CLEAR_RECORDING_SESSIONS';
+/**
+ * The type of Redux action which marks a session ID as consent requested.
+ *
+ * {
+ * type: MARK_CONSENT_REQUESTED,
+ * sessionId: string
+ * }
+ */
+export const MARK_CONSENT_REQUESTED = 'MARK_CONSENT_REQUESTED';
+
/**
* The type of Redux action which updates the current known state of a recording
* session.
diff --git a/react/features/recording/actions.any.ts b/react/features/recording/actions.any.ts
index ff25d318a1..d124b3d782 100644
--- a/react/features/recording/actions.any.ts
+++ b/react/features/recording/actions.any.ts
@@ -20,6 +20,7 @@ import { isRecorderTranscriptionsRunning } from '../transcribing/functions';
import {
CLEAR_RECORDING_SESSIONS,
+ MARK_CONSENT_REQUESTED,
RECORDING_SESSION_UPDATED,
SET_MEETING_HIGHLIGHT_BUTTON_STATE,
SET_PENDING_RECORDING_NOTIFICATION_UID,
@@ -476,3 +477,17 @@ export function showStartRecordingNotificationWithCallback(openRecordingDialog:
}, NOTIFICATION_TIMEOUT_TYPE.EXTRA_LONG));
};
}
+
+/**
+ * Marks the given session as consent requested. No further consent requests will be
+ * made for this session.
+ *
+ * @param {string} sessionId - The session id.
+ * @returns {Object}
+ */
+export function markConsentRequested(sessionId: string) {
+ return {
+ type: MARK_CONSENT_REQUESTED,
+ sessionId
+ };
+}
diff --git a/react/features/recording/functions.ts b/react/features/recording/functions.ts
index 36001d728b..b5251d8a97 100644
--- a/react/features/recording/functions.ts
+++ b/react/features/recording/functions.ts
@@ -442,6 +442,7 @@ export function shouldRequireRecordingConsent(recorderSession: any, state: IRedu
const { requireRecordingConsent } = state['features/dynamic-branding'] || {};
const { requireConsent } = state['features/base/config'].recordings || {};
const { iAmRecorder } = state['features/base/config'];
+ const { consentRequested } = state['features/recording'];
if (iAmRecorder) {
return false;
@@ -455,10 +456,15 @@ export function shouldRequireRecordingConsent(recorderSession: any, state: IRedu
return false;
}
- if (!recorderSession.getInitiator()
- || recorderSession.getStatus() === JitsiRecordingConstants.status.OFF) {
+ if (consentRequested.has(recorderSession.getID())) {
return false;
}
- return recorderSession.getInitiator() !== getLocalParticipant(state)?.id;
+ const initiator = recorderSession.getInitiator();
+
+ if (!initiator || recorderSession.getStatus() === JitsiRecordingConstants.status.OFF) {
+ return false;
+ }
+
+ return initiator !== getLocalParticipant(state)?.id;
}
diff --git a/react/features/recording/middleware.ts b/react/features/recording/middleware.ts
index cac598dfe0..289d74270b 100644
--- a/react/features/recording/middleware.ts
+++ b/react/features/recording/middleware.ts
@@ -36,6 +36,7 @@ import { isRecorderTranscriptionsRunning } from '../transcribing/functions';
import { RECORDING_SESSION_UPDATED, START_LOCAL_RECORDING, STOP_LOCAL_RECORDING } from './actionTypes';
import {
clearRecordingSessions,
+ markConsentRequested,
hidePendingRecordingNotification,
showPendingRecordingNotification,
showRecordingError,
@@ -420,6 +421,7 @@ function _showExplicitConsentDialog(recorderSession: any, dispatch: IStore['disp
}
batch(() => {
+ dispatch(markConsentRequested(recorderSession.getID()));
dispatch(setAudioUnmutePermissions(true, true));
dispatch(setVideoUnmutePermissions(true, true));
dispatch(setAudioMuted(true));
diff --git a/react/features/recording/reducer.ts b/react/features/recording/reducer.ts
index 70c5468211..17f3489be5 100644
--- a/react/features/recording/reducer.ts
+++ b/react/features/recording/reducer.ts
@@ -2,6 +2,7 @@ import ReducerRegistry from '../base/redux/ReducerRegistry';
import {
CLEAR_RECORDING_SESSIONS,
+ MARK_CONSENT_REQUESTED,
RECORDING_SESSION_UPDATED,
SET_MEETING_HIGHLIGHT_BUTTON_STATE,
SET_PENDING_RECORDING_NOTIFICATION_UID,
@@ -11,6 +12,7 @@ import {
} from './actionTypes';
const DEFAULT_STATE = {
+ consentRequested: new Set(),
disableHighlightMeetingMoment: false,
pendingNotificationUids: {},
selectedRecordingService: '',
@@ -29,6 +31,7 @@ export interface ISessionData {
}
export interface IRecordingState {
+ consentRequested: Set<any>;
disableHighlightMeetingMoment: boolean;
pendingNotificationUids: {
[key: string]: string | undefined;
@@ -57,6 +60,15 @@ ReducerRegistry.register<IRecordingState>(STORE_NAME,
sessionDatas: []
};
+ case MARK_CONSENT_REQUESTED:
+ return {
+ ...state,
+ consentRequested: new Set([
+ ...state.consentRequested,
+ action.sessionId
+ ])
+ };
+
case RECORDING_SESSION_UPDATED:
return {
...state,