diff --git a/bigbluebutton-html5/imports/api/meetings/server/modifiers/clearMeetingTimeRemaining.js b/bigbluebutton-html5/imports/api/meetings/server/modifiers/clearMeetingTimeRemaining.js new file mode 100644 index 0000000000..9be8b4abc3 --- /dev/null +++ b/bigbluebutton-html5/imports/api/meetings/server/modifiers/clearMeetingTimeRemaining.js @@ -0,0 +1,26 @@ +import { MeetingTimeRemaining } from '/imports/api/meetings'; +import Logger from '/imports/startup/server/logger'; + +export default function clearMeetingTimeRemaining(meetingId) { + if (meetingId) { + try { + const numberAffected = MeetingTimeRemaining.remove({ meetingId }); + + if (numberAffected) { + Logger.info(`Cleared MeetingTimeRemaining in (${meetingId})`); + } + } catch (err) { + Logger.info(`Error on clearing MeetingTimeRemaining in (${meetingId}). ${err}`); + } + } else { + try { + const numberAffected = MeetingTimeRemaining.remove({}); + + if (numberAffected) { + Logger.info('Cleared MeetingTimeRemaining in all meetings'); + } + } catch (err) { + Logger.error(`Error on clearing MeetingTimeRemaining in all meetings. ${err}`); + } + } +} diff --git a/bigbluebutton-html5/imports/api/meetings/server/modifiers/meetingHasEnded.js b/bigbluebutton-html5/imports/api/meetings/server/modifiers/meetingHasEnded.js index 3f7cc292df..255a97a453 100755 --- a/bigbluebutton-html5/imports/api/meetings/server/modifiers/meetingHasEnded.js +++ b/bigbluebutton-html5/imports/api/meetings/server/modifiers/meetingHasEnded.js @@ -18,6 +18,7 @@ import clearVoiceUsers from '/imports/api/voice-users/server/modifiers/clearVoic import clearUserInfo from '/imports/api/users-infos/server/modifiers/clearUserInfo'; import clearNote from '/imports/api/note/server/modifiers/clearNote'; import clearNetworkInformation from '/imports/api/network-information/server/modifiers/clearNetworkInformation'; +import clearMeetingTimeRemaining from '/imports/api/meetings/server/modifiers/clearMeetingTimeRemaining'; import clearLocalSettings from '/imports/api/local-settings/server/modifiers/clearLocalSettings'; import clearRecordMeeting from './clearRecordMeeting'; import clearVoiceCallStates from '/imports/api/voice-call-states/server/modifiers/clearVoiceCallStates'; @@ -46,6 +47,7 @@ export default function meetingHasEnded(meetingId) { clearNote(meetingId); clearNetworkInformation(meetingId); clearLocalSettings(meetingId); + clearMeetingTimeRemaining(meetingId); clearRecordMeeting(meetingId); clearVoiceCallStates(meetingId); clearVideoStreams(meetingId);