change(ui): disable edit for diff notes

This commit is contained in:
sylenien 2022-10-03 11:31:05 +02:00
parent af9f8e6e71
commit 0ee111ad19
2 changed files with 4 additions and 2 deletions

View file

@ -11,7 +11,7 @@ import { setEditNoteTooltip } from 'Duck/sessions';
// TODO: incapsulate toggler in LocationEvent
@withToggle("showLoadInfo", "toggleLoadInfo")
@connect(state => ({members: state.getIn(['members', 'list'])}), { setEditNoteTooltip })
@connect(state => ({members: state.getIn(['members', 'list']), currentUserId: state.getIn(['account', 'id']) }), { setEditNoteTooltip })
class EventGroupWrapper extends React.Component {
toggleLoadInfo = (e) => {
@ -81,6 +81,7 @@ class EventGroupWrapper extends React.Component {
noteId={event.noteId}
filterOutNote={filterOutNote}
onEdit={this.props.setEditNoteTooltip}
noEdit={this.props.currentUserId !== event.userId}
/>
) : isLocation
? <Event

View file

@ -20,6 +20,7 @@ interface Props {
sessionId: string;
date: string;
noteId: number;
noEdit: boolean;
filterOutNote: (id: number) => void;
onEdit: (noteTooltipObj: Record<string, any>) => void;
}
@ -69,7 +70,7 @@ function NoteEvent(props: Props) {
}
};
const menuItems = [
{ icon: 'pencil', text: 'Edit', onClick: onEdit },
{ icon: 'pencil', text: 'Edit', onClick: onEdit, disabled: props.onEdit },
{ icon: 'link-45deg', text: 'Copy URL', onClick: onCopy },
{ icon: 'trash', text: 'Delete', onClick: onDelete },
];