Merge pull request #9518 from KDSBrowne/issue-9511

Change shared notes lock behavior
This commit is contained in:
Anton Georgiev 2020-05-12 17:55:48 -04:00 committed by GitHub
commit 4e636a2396
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 53 additions and 11 deletions

View File

@ -43,7 +43,7 @@ const isLocked = () => {
const meeting = Meetings.findOne({ meetingId: Auth.meetingID }, { fields: { 'lockSettingsProps.disableNote': 1 } });
const user = Users.findOne({ userId: Auth.userID }, { fields: { locked: 1, role: 1 } });
if (meeting.lockSettingsProps && user.locked && user.role !== ROLE_MODERATOR) {
if (meeting.lockSettingsProps && user.role !== ROLE_MODERATOR) {
return meeting.lockSettingsProps.disableNote;
}
return false;
@ -75,7 +75,7 @@ const isEnabled = () => {
const toggleNotePanel = () => {
Session.set(
'openPanel',
isPanelOpened() ? 'userlist' : 'note'
isPanelOpened() ? 'userlist' : 'note',
);
};

View File

@ -286,8 +286,7 @@ const isMeetingLocked = (id) => {
if (lockSettings.disableCam
|| lockSettings.disableMic
|| lockSettings.disablePrivateChat
|| lockSettings.disablePublicChat
|| lockSettings.disableNote) {
|| lockSettings.disablePublicChat) {
isLocked = true;
}
}

View File

@ -134,3 +134,8 @@
overflow: hidden;
flex-shrink: 1;
}
.noteLock {
font-size: 65%;
color: var(--color-gray-light);
}

View File

@ -26,6 +26,14 @@ const intlMessages = defineMessages({
id: 'app.userList.notesListItem.unreadContent',
description: 'Aria label for notes unread content',
},
locked: {
id: 'app.userList.locked',
description: '',
},
byModerator: {
id: 'app.userList.byModerator',
description: '',
},
});
class UserNotes extends Component {
@ -57,7 +65,7 @@ class UserNotes extends Component {
}
renderNotes() {
const { intl } = this.props;
const { intl, disableNote } = this.props;
const { unread } = this.state;
let notification = null;
@ -82,14 +90,26 @@ class UserNotes extends Component {
onClick={NoteService.toggleNotePanel}
>
<Icon iconName="copy" />
<span aria-hidden>{intl.formatMessage(intlMessages.sharedNotes)}</span>
<div aria-hidden>
<div>
{intl.formatMessage(intlMessages.sharedNotes)}
</div>
{disableNote
? (
<div className={styles.noteLock}>
<Icon iconName="lock" />
<span>{`${intl.formatMessage(intlMessages.locked)} ${intl.formatMessage(intlMessages.byModerator)}`}</span>
</div>
) : null
}
</div>
{notification}
</div>
);
}
render() {
const { intl } = this.props;
const { intl, disableNote } = this.props;
if (!NoteService.isEnabled()) return null;

View File

@ -1,11 +1,28 @@
import React from 'react';
import { withTracker } from 'meteor/react-meteor-data';
import NoteService from '/imports/ui/components/note/service';
import Meetings from '/imports/api/meetings';
import Users from '/imports/api/users';
import Auth from '/imports/ui/services/auth';
import UserNotes from './component';
const ROLE_VIEWER = Meteor.settings.public.user.role_viewer;
const UserNotesContainer = props => <UserNotes {...props} />;
export default withTracker(() => ({
isPanelOpened: NoteService.isPanelOpened(),
revs: NoteService.getRevs(),
}))(UserNotesContainer);
export default withTracker(() => {
const Meeting = Meetings.findOne({ meetingId: Auth.meetingID },
{ fields: { 'lockSettingsProps.disableNote': 1 } });
const isViewer = Users.findOne({ meetingId: Auth.meetingID, userId: Auth.userID }, {
fields: {
role: 1,
},
}).role === ROLE_VIEWER;
const shouldDisableNote = (Meeting.lockSettingsProps.disableNote) && isViewer;
return {
isPanelOpened: NoteService.isPanelOpened(),
revs: NoteService.getRevs(),
disableNote: shouldDisableNote,
};
})(UserNotesContainer);

View File

@ -63,6 +63,7 @@
"app.userList.presenter": "Presenter",
"app.userList.you": "You",
"app.userList.locked": "Locked",
"app.userList.byModerator": "by (Moderator)",
"app.userList.label": "User list",
"app.userList.toggleCompactView.label": "Toggle compact view mode",
"app.userList.guest": "Guest",