diff --git a/web/calendar/entry.react.js b/web/calendar/entry.react.js --- a/web/calendar/entry.react.js +++ b/web/calendar/entry.react.js @@ -22,7 +22,7 @@ import { threadInfoSelector } from 'lib/selectors/thread-selectors.js'; import { colorIsDark } from 'lib/shared/color-utils.js'; import { entryKey } from 'lib/shared/entry-utils.js'; -import { threadHasPermission } from 'lib/shared/thread-utils.js'; +import { useThreadHasPermission } from 'lib/shared/thread-utils.js'; import { type EntryInfo, type CreateEntryInfo, @@ -66,6 +66,7 @@ ...BaseProps, +threadInfo: ResolvedThreadInfo, +loggedIn: boolean, + +currentUserCanEditEntry: boolean, +calendarQuery: () => CalendarQuery, +online: boolean, +dispatch: Dispatch, @@ -202,10 +203,6 @@ }); const style = { backgroundColor: `#${this.props.threadInfo.color}` }; const loadingIndicatorColor = darkColor ? 'white' : 'black'; - const canEditEntry = threadHasPermission( - this.props.threadInfo, - threadPermissions.EDIT_ENTRIES, - ); return (
!!(state.currentUserInfo && !state.currentUserInfo.anonymous && true), ); + const currentUserCanEditEntry = useThreadHasPermission( + threadInfo, + threadPermissions.EDIT_ENTRIES, + ); const calendarQuery = useSelector(nonThreadCalendarQuery); const keyserverID = extractKeyserverIDFromID(threadID); const connection = useSelector(connectionSelector(keyserverID)); @@ -492,6 +493,7 @@ {...props} threadInfo={threadInfo} loggedIn={loggedIn} + currentUserCanEditEntry={currentUserCanEditEntry} calendarQuery={calendarQuery} online={online} createEntry={callCreateEntry}