Skip to content
Snippets Groups Projects
Unverified Commit 473b9c18 authored by Anton Georgiev's avatar Anton Georgiev Committed by GitHub
Browse files

Merge pull request #7512 from diegobenetti/issue7401-notify-lock-disabled

Implemented notification when a lock is disabled
parents 302c1380 64a2ef7a
No related branches found
No related tags found
No related merge requests found
......@@ -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');
}
}
......
......@@ -83,6 +83,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",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment