Page MenuHomePhabricator

D11748.id39425.diff
No OneTemporary

D11748.id39425.diff

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 (
<div
className={entryClasses}
@@ -222,7 +219,7 @@
onBlur={this.onBlur}
tabIndex={this.props.tabIndex}
ref={this.textareaRef}
- disabled={!canEditEntry}
+ disabled={!this.props.currentUserCanEditEntry}
/>
<LoadingIndicator
status={this.state.loadingStatus}
@@ -471,6 +468,10 @@
state =>
!!(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}

File Metadata

Mime Type
text/plain
Expires
Sun, Nov 24, 4:16 AM (21 h, 23 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2573319
Default Alt Text
D11748.id39425.diff (2 KB)

Event Timeline