From 3f16d894c393a8284e9437f1fb25f91f24e0ca43 Mon Sep 17 00:00:00 2001 From: Lucas Zawacki Date: Wed, 17 Jun 2020 21:08:36 +0000 Subject: [PATCH] Configurable ending time and alert values --- .../breakout-remaining-time/container.jsx | 7 +++-- .../notifications-bar/container.jsx | 27 ++++++++++++------- .../private/config/settings.yml | 3 ++- bigbluebutton-html5/private/locales/en.json | 6 +++-- 4 files changed, 28 insertions(+), 15 deletions(-) diff --git a/bigbluebutton-html5/imports/ui/components/breakout-room/breakout-remaining-time/container.jsx b/bigbluebutton-html5/imports/ui/components/breakout-room/breakout-remaining-time/container.jsx index d128ddd01d..c92378afc4 100644 --- a/bigbluebutton-html5/imports/ui/components/breakout-room/breakout-remaining-time/container.jsx +++ b/bigbluebutton-html5/imports/ui/components/breakout-room/breakout-remaining-time/container.jsx @@ -83,7 +83,8 @@ export default injectNotify(injectIntl(withTracker(({ notify, messageDuration, timeEndedMessage, - alertMessageUnderOneMinute, + alertMessage, + alertUnderMinutes, }) => { const data = {}; if (breakoutRoom) { @@ -104,7 +105,9 @@ export default injectNotify(injectIntl(withTracker(({ if (timeRemaining >= 0 && timeRemainingInterval) { if (timeRemaining > 0) { const time = getTimeRemaining(); - if (time === (1 * 60) && alertMessageUnderOneMinute) notify(alertMessageUnderOneMinute, 'info', 'rooms'); + if (time === (alertUnderMinutes * 60) && alertMessage) { + notify(alertMessage, 'info', 'rooms'); + } data.message = intl.formatMessage(messageDuration, { 0: humanizeSeconds(time) }); } else { clearInterval(timeRemainingInterval); diff --git a/bigbluebutton-html5/imports/ui/components/notifications-bar/container.jsx b/bigbluebutton-html5/imports/ui/components/notifications-bar/container.jsx index b5f3cee290..e9dc29e41c 100644 --- a/bigbluebutton-html5/imports/ui/components/notifications-bar/container.jsx +++ b/bigbluebutton-html5/imports/ui/components/notifications-bar/container.jsx @@ -30,6 +30,7 @@ const ENABLE_NETWORK_MONITORING = Meteor.settings.public.networkMonitoring.enabl const HELP_LINK = METEOR_SETTINGS_APP.helpLink; const REMAINING_TIME_THRESHOLD = METEOR_SETTINGS_APP.remainingTimeThreshold; +const REMAINING_TIME_ALERT_THRESHOLD = METEOR_SETTINGS_APP.remainingTimeAlertThreshold; const intlMessages = defineMessages({ failedMessage: { @@ -68,13 +69,13 @@ const intlMessages = defineMessages({ id: 'app.meeting.meetingTimeHasEnded', description: 'Message that tells time has ended and meeting will close', }, - alertMeetingEndsUnderOneMinute: { - id: 'app.meeting.alertMeetingEndsUnderOneMinute', - description: 'Alert that tells that the meeting end under a minute', + alertMeetingEndsUnderMinutes: { + id: 'app.meeting.alertMeetingEndsUnderMinutes', + description: 'Alert that tells that the meeting ends under x minutes', }, - alertBreakoutEndsUnderOneMinute: { - id: 'app.meeting.alertBreakoutEndsUnderOneMinute', - description: 'Alert that tells that the breakout end under a minute', + alertBreakoutEndsUnderMinutes: { + id: 'app.meeting.alertBreakoutEndsUnderMinutes', + description: 'Alert that tells that the breakout ends under x minutes', }, slowEffectiveConnectionDetected: { id: 'app.network.connection.effective.slow', @@ -183,6 +184,8 @@ export default injectIntl(withTracker(({ intl }) => { const meetingId = Auth.meetingID; const breakouts = breakoutService.getBreakouts(); + const msg = { id: `${intlMessages.alertBreakoutEndsUnderMinutes.id}${REMAINING_TIME_ALERT_THRESHOLD == 1 ? 'Singular' : 'Plural'}` }; + if (breakouts.length > 0) { const currentBreakout = breakouts.find(b => b.breakoutId === meetingId); @@ -192,9 +195,10 @@ export default injectIntl(withTracker(({ intl }) => { breakoutRoom={currentBreakout} messageDuration={intlMessages.breakoutTimeRemaining} timeEndedMessage={intlMessages.breakoutWillClose} - alertMessageUnderOneMinute={ - intl.formatMessage(intlMessages.alertBreakoutEndsUnderOneMinute) + alertMessage={ + intl.formatMessage(msg, {0: REMAINING_TIME_ALERT_THRESHOLD}) } + alertUnderMinutes={REMAINING_TIME_ALERT_THRESHOLD} /> ); } @@ -209,15 +213,18 @@ export default injectIntl(withTracker(({ intl }) => { const { isBreakout } = Meeting.meetingProp; const underThirtyMin = timeRemaining && timeRemaining <= (REMAINING_TIME_THRESHOLD * 60); + const msg = { id: `${intlMessages.alertMeetingEndsUnderMinutes.id}${REMAINING_TIME_ALERT_THRESHOLD == 1 ? 'Singular' : 'Plural'}` }; + if (underThirtyMin && !isBreakout) { data.message = ( ); } diff --git a/bigbluebutton-html5/private/config/settings.yml b/bigbluebutton-html5/private/config/settings.yml index 111686225d..243b65b03e 100755 --- a/bigbluebutton-html5/private/config/settings.yml +++ b/bigbluebutton-html5/private/config/settings.yml @@ -25,7 +25,8 @@ public: ipv4FallbackDomain: "" allowLogout: true allowFullscreen: true - remainingTimeThreshold: 5 + remainingTimeThreshold: 30 + remainingTimeAlertThreshold: 1 defaultSettings: application: animations: true diff --git a/bigbluebutton-html5/private/locales/en.json b/bigbluebutton-html5/private/locales/en.json index 4c1446fe52..e93542a833 100755 --- a/bigbluebutton-html5/private/locales/en.json +++ b/bigbluebutton-html5/private/locales/en.json @@ -126,8 +126,10 @@ "app.meeting.meetingTimeRemaining": "Meeting time remaining: {0}", "app.meeting.meetingTimeHasEnded": "Time ended. Meeting will close soon", "app.meeting.endedMessage": "You will be forwarded back to the home screen", - "app.meeting.alertMeetingEndsUnderOneMinute": "Meeting is closing in a minute.", - "app.meeting.alertBreakoutEndsUnderOneMinute": "Breakout is closing in a minute.", + "app.meeting.alertMeetingEndsUnderMinutesSingular": "Meeting is closing in one minute.", + "app.meeting.alertMeetingEndsUnderMinutesPlural": "Meeting is closing in {0} minutes.", + "app.meeting.alertBreakoutEndsUnderMinutesSingular": "Breakout is closing in {0} minutes.", + "app.meeting.alertBreakoutEndsUnderMinutesPlural": "Breakout is closing in one minute.", "app.presentation.hide": "Hide presentation", "app.presentation.notificationLabel": "Current presentation", "app.presentation.slideContent": "Slide Content",