only display record notification if create param is set to true

This commit is contained in:
Ramón Souza 2022-03-14 14:03:54 +00:00
parent e5a3bffb36
commit e369d6c487
3 changed files with 30 additions and 12 deletions

View File

@ -81,15 +81,15 @@ class RecordingIndicator extends PureComponent {
}
componentDidMount() {
const { recording } = this.props;
const { recording, recordingNotificationEnabled } = this.props;
if (recording) {
if (recordingNotificationEnabled && recording) {
this.toggleShouldNotify();
}
}
componentDidUpdate(prevProps) {
const { recording, mountModal, getModal } = this.props;
const { recording, mountModal, getModal, recordingNotificationEnabled } = this.props;
const { shouldNotify } = this.state;
if (!recording) {
@ -98,16 +98,18 @@ class RecordingIndicator extends PureComponent {
} else if (this.interval === null) {
this.interval = setInterval(this.incrementTime, 1000);
}
if (!prevProps.recording && recording && !shouldNotify) {
return this.setState({shouldNotify: true});
}
const isModalOpen = !!getModal();
// should only display notification modal when other modals are closed
if (shouldNotify && !isModalOpen) {
mountModal(<RecordingNotifyContainer toggleShouldNotify={this.toggleShouldNotify} />);
if (recordingNotificationEnabled) {
if (!prevProps.recording && recording && !shouldNotify) {
return this.setState({shouldNotify: true});
}
const isModalOpen = !!getModal();
// should only display notification modal when other modals are closed
if (shouldNotify && !isModalOpen) {
mountModal(<RecordingNotifyContainer toggleShouldNotify={this.toggleShouldNotify} />);
}
}
}

View File

@ -6,6 +6,7 @@ import { notify } from '/imports/ui/services/notification';
import VoiceUsers from '/imports/api/voice-users';
import RecordIndicator from './component';
import deviceInfo from '/imports/utils/deviceInfo';
import RecordingIndicatorService from './service';
const RecordIndicatorContainer = props => (
<RecordIndicator {...props} />
@ -30,5 +31,6 @@ export default withTracker(() => {
notify,
micUser,
isPhone: deviceInfo.isPhone,
recordingNotificationEnabled: RecordingIndicatorService.isRecordingNotificationEnabled(),
};
})(RecordIndicatorContainer);

View File

@ -0,0 +1,14 @@
import Auth from '/imports/ui/services/auth';
import Meetings from '/imports/api/meetings';
const isRecordingNotificationEnabled = () => (((
Meetings.findOne(
{ meetingId: Auth.meetingID },
{
fields: { 'meetingProp.notifyRecordingIsOn': 1 },
},
) || {}).meetingProp || {}).notifyRecordingIsOn || false);
export default {
isRecordingNotificationEnabled,
};