Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3351972
D11748.id39425.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D11748.id39425.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D11748: [web] Replace `threadHasPermission` with `useThreadHasPermission` in `Entry`
Attached
Detach File
Event Timeline
Log In to Comment