Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.
TypeScript debiandeep-videojitsijitsi-meetscalable-video-conferencessfuvideovideo-communicationvideo-conferencingwebrtc
reducer should be a pure function
Radium Zheng0f3b67e53ea5
diff --git a/react/features/local-recording/actionTypes.js b/react/features/local-recording/actionTypes.jsindex 5f002eab1f..c154100ff6 100644--- a/react/features/local-recording/actionTypes.js+++ b/react/features/local-recording/actionTypes.js@@ -3,7 +3,8 @@* (as in: {@code RecordingAdapter} is actively collecting audio data).** {- * type: LOCAL_RECORDING_ENGAGED+ * type: LOCAL_RECORDING_ENGAGED,+ * recordingEngagedAt: Date* }*/export const LOCAL_RECORDING_ENGAGED = Symbol('LOCAL_RECORDING_ENGAGED');@@ -29,11 +30,12 @@ export const LOCAL_RECORDING_TOGGLE_DIALOG= Symbol('LOCAL_RECORDING_TOGGLE_DIALOG');/**- * Action to update {@code LocalRecordingInfoDialog} with stats- * from all clients.+ * Action to update {@code LocalRecordingInfoDialog} with stats from all+ * clients.** {- * type: LOCAL_RECORDING_STATS_UPDATE+ * type: LOCAL_RECORDING_STATS_UPDATE,+ * stats: Object* }*/export const LOCAL_RECORDING_STATS_UPDATEdiff --git a/react/features/local-recording/actions.js b/react/features/local-recording/actions.jsindex fea3cdb834..8f184dbc36 100644--- a/react/features/local-recording/actions.js+++ b/react/features/local-recording/actions.js@@ -14,15 +14,18 @@ import {// recording in the UI./**- * Signals that local recording has started.+ * Signals that local recording has been engaged.*+ * @param {Date} startTime - Time when the recording is engaged.* @returns {{- * type: LOCAL_RECORDING_ENGAGED+ * type: LOCAL_RECORDING_ENGAGED,+ * recordingEngagedAt: Date* }}*/-export function localRecordingEngaged() {+export function localRecordingEngaged(startTime: Date) {return {- type: LOCAL_RECORDING_ENGAGED+ type: LOCAL_RECORDING_ENGAGED,+ recordingEngagedAt: startTime};}diff --git a/react/features/local-recording/components/LocalRecordingInfoDialog.js b/react/features/local-recording/components/LocalRecordingInfoDialog.jsindex 1a1d47e153..7b0103e0cb 100644--- a/react/features/local-recording/components/LocalRecordingInfoDialog.js+++ b/react/features/local-recording/components/LocalRecordingInfoDialog.js@@ -44,7 +44,7 @@ type Props = {* The start time of the current local recording session.* Used to calculate the duration of recording.*/- recordingStartedAt: Date,+ recordingEngagedAt: Date,/*** Stats of all the participant.@@ -103,11 +103,11 @@ class LocalRecordingInfoDialog extends Component<Props, State> {this._timer = setInterval(() => {this.setState((_prevState, props) => {- const nowTime = new Date(Date.now());+ const nowTime = new Date();return {durationString: this._getDuration(nowTime,- props.recordingStartedAt)+ props.recordingEngagedAt)};});try {@@ -312,7 +312,7 @@ class LocalRecordingInfoDialog extends Component<Props, State> {* encodingFormat: string,* isModerator: boolean,* isOn: boolean,- * recordingStartedAt: Date,+ * recordingEngagedAt: Date,* stats: Object* }}*/@@ -320,7 +320,7 @@ function _mapStateToProps(state) {const {encodingFormat,isEngaged: isOn,- recordingStartedAt,+ recordingEngagedAt,stats} = state['features/local-recording'];const isModerator@@ -330,7 +330,7 @@ function _mapStateToProps(state) {encodingFormat,isModerator,isOn,- recordingStartedAt,+ recordingEngagedAt,stats};}diff --git a/react/features/local-recording/middleware.js b/react/features/local-recording/middleware.jsindex 2c904b3493..133636fddb 100644--- a/react/features/local-recording/middleware.js+++ b/react/features/local-recording/middleware.js@@ -24,7 +24,9 @@ MiddlewareRegistry.register(({ getState, dispatch }) => next => action => {// react to state changes in recordingController.recordingController.onStateChanged = function(isEngaged) {if (isEngaged) {- dispatch(localRecordingEngaged());+ const nowTime = new Date();++ dispatch(localRecordingEngaged(nowTime));} else {dispatch(localRecordingUnengaged());}diff --git a/react/features/local-recording/reducer.js b/react/features/local-recording/reducer.jsindex 7e370e64c8..619590320c 100644--- a/react/features/local-recording/reducer.js+++ b/react/features/local-recording/reducer.js@@ -15,7 +15,7 @@ ReducerRegistry.register('features/local-recording', (state = {}, action) => {return {...state,isEngaged: true,- recordingStartedAt: new Date(Date.now()),+ recordingEngagedAt: action.recordingEngagedAt,encodingFormat: recordingController._format};}@@ -23,7 +23,7 @@ ReducerRegistry.register('features/local-recording', (state = {}, action) => {return {...state,isEngaged: false,- recordingStartedAt: null+ recordingEngagedAt: null};case LOCAL_RECORDING_TOGGLE_DIALOG:return {