From 64a2ef7a66acc70f2634fdcdb4ec1b29e1f0c9d2 Mon Sep 17 00:00:00 2001 From: Diego Benetti <diegob@imdt.com.br> Date: Mon, 27 May 2019 13:33:19 -0300 Subject: [PATCH] Implemented notification when a lock is disabled --- .../lock-viewers/notify/component.jsx | 57 +++++++++++++++++-- bigbluebutton-html5/private/locales/en.json | 6 ++ 2 files changed, 57 insertions(+), 6 deletions(-) diff --git a/bigbluebutton-html5/imports/ui/components/lock-viewers/notify/component.jsx b/bigbluebutton-html5/imports/ui/components/lock-viewers/notify/component.jsx index 3edcdfd6b6..95bde9fcde 100644 --- a/bigbluebutton-html5/imports/ui/components/lock-viewers/notify/component.jsx +++ b/bigbluebutton-html5/imports/ui/components/lock-viewers/notify/component.jsx @@ -3,7 +3,7 @@ import { defineMessages, injectIntl } from 'react-intl'; import { notify } from '/imports/ui/services/notification'; import _ from 'lodash'; -const intlMessages = defineMessages({ +const intlDisableMessages = defineMessages({ disableCam: { id: 'app.userList.userOptions.disableCam', description: 'label to disable cam notification', @@ -30,6 +30,33 @@ const intlMessages = defineMessages({ }, }); +const intlEnableMessages = defineMessages({ + disableCam: { + id: 'app.userList.userOptions.enableCam', + description: 'label to enable cam notification', + }, + disableMic: { + id: 'app.userList.userOptions.enableMic', + description: 'label to enable mic notification', + }, + disablePrivateChat: { + id: 'app.userList.userOptions.enablePrivChat', + description: 'label to enable private chat notification', + }, + disablePublicChat: { + id: 'app.userList.userOptions.enablePubChat', + description: 'label to enable private chat notification', + }, + disableNote: { + id: 'app.userList.userOptions.enableNote', + description: 'label to enable note notification', + }, + onlyModeratorWebcam: { + id: 'app.userList.userOptions.enableOnlyModeratorWebcam', + description: 'label to enable all webcams except for the moderators cam', + }, +}); + class LockViewersNotifyComponent extends Component { componentDidUpdate(prevProps) { const { @@ -43,18 +70,36 @@ class LockViewersNotifyComponent extends Component { webcamsOnlyForModerator: prevWebcamsOnlyForModerator, } = prevProps; + function notifyLocks(arrLocks, intlMessages) { + arrLocks.forEach((key) => { + notify(intl.formatMessage(intlMessages[key]), 'info', 'lock'); + }); + } + if (!_.isEqual(lockSettings, prevLockSettings)) { const rejectedKeys = ['setBy', 'lockedLayout']; - const filteredSettings = Object.keys(lockSettings) + + const disabledSettings = Object.keys(lockSettings) .filter(key => prevLockSettings[key] !== lockSettings[key] && lockSettings[key] && !rejectedKeys.includes(key)); - filteredSettings.forEach((key) => { - notify(intl.formatMessage(intlMessages[key]), 'info', 'lock'); - }); + const enableSettings = Object.keys(lockSettings) + .filter(key => prevLockSettings[key] !== lockSettings[key] + && !lockSettings[key] + && !rejectedKeys.includes(key)); + + if (disabledSettings.length > 0) { + notifyLocks(disabledSettings, intlDisableMessages); + } + if (enableSettings.length > 0) { + notifyLocks(enableSettings, intlEnableMessages); + } } if (webcamsOnlyForModerator && !prevWebcamsOnlyForModerator) { - notify(intl.formatMessage(intlMessages.onlyModeratorWebcam), 'info', 'lock'); + notify(intl.formatMessage(intlDisableMessages.onlyModeratorWebcam), 'info', 'lock'); + } + if (!webcamsOnlyForModerator && prevWebcamsOnlyForModerator) { + notify(intl.formatMessage(intlEnableMessages.onlyModeratorWebcam), 'info', 'lock'); } } diff --git a/bigbluebutton-html5/private/locales/en.json b/bigbluebutton-html5/private/locales/en.json index 57a3c39722..c9087364e0 100755 --- a/bigbluebutton-html5/private/locales/en.json +++ b/bigbluebutton-html5/private/locales/en.json @@ -68,6 +68,12 @@ "app.userList.userOptions.disablePubChat": "Public chat is disabled", "app.userList.userOptions.disableNote": "Shared notes are now locked", "app.userList.userOptions.webcamsOnlyForModerator": "Only moderators are able to see viewers' webcams (due to lock settings)", + "app.userList.userOptions.enableCam": "Viewers' webcams are enabled", + "app.userList.userOptions.enableMic": "Viewers' microphones are enabled", + "app.userList.userOptions.enablePrivChat": "Private chat is enabled", + "app.userList.userOptions.enablePubChat": "Public chat is enabled", + "app.userList.userOptions.enableNote": "Shared notes are now enabled", + "app.userList.userOptions.enableOnlyModeratorWebcam": "You can enable your webcam now, everyone will see you", "app.media.label": "Media", "app.media.screenshare.start": "Screenshare has started", "app.media.screenshare.end": "Screenshare has ended", -- GitLab