Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F32542999
D11748.1767172855.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D11748.1767172855.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
Wed, Dec 31, 9:20 AM (4 h, 7 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5872937
Default Alt Text
D11748.1767172855.diff (2 KB)
Attached To
Mode
D11748: [web] Replace `threadHasPermission` with `useThreadHasPermission` in `Entry`
Attached
Detach File
Event Timeline
Log In to Comment