Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3375035
D11754.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
D11754.diff
View Options
diff --git a/native/chat/settings/thread-settings-description.react.js b/native/chat/settings/thread-settings-description.react.js
--- a/native/chat/settings/thread-settings-description.react.js
+++ b/native/chat/settings/thread-settings-description.react.js
@@ -14,7 +14,7 @@
useChangeThreadSettings,
} from 'lib/actions/thread-actions.js';
import { createLoadingStatusSelector } from 'lib/selectors/loading-selectors.js';
-import { threadHasPermission } from 'lib/shared/thread-utils.js';
+import { useThreadHasPermission } from 'lib/shared/thread-utils.js';
import type { LoadingStatus } from 'lib/types/loading-types.js';
import type { ThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js';
import { threadPermissions } from 'lib/types/thread-permission-types.js';
@@ -107,6 +107,7 @@
+changeThreadSettings: (
update: UpdateThreadRequest,
) => Promise<ChangeThreadSettingsPayload>,
+ +canEditThreadDescription: boolean,
};
class ThreadSettingsDescription extends React.PureComponent<Props> {
textInput: ?React.ElementRef<typeof BaseTextInput>;
@@ -162,12 +163,8 @@
);
}
- const canEditThreadDescription = threadHasPermission(
- this.props.threadInfo,
- threadPermissions.EDIT_THREAD_DESCRIPTION,
- );
const { panelIosHighlightUnderlay } = this.props.colors;
- if (canEditThreadDescription) {
+ if (this.props.canEditThreadDescription) {
return (
<View>
<ThreadSettingsCategoryHeader type="outline" title="Description" />
@@ -310,6 +307,12 @@
const dispatchActionPromise = useDispatchActionPromise();
const callChangeThreadSettings = useChangeThreadSettings();
+
+ const canEditThreadDescription = useThreadHasPermission(
+ props.threadInfo,
+ threadPermissions.EDIT_THREAD_DESCRIPTION,
+ );
+
return (
<ThreadSettingsDescription
{...props}
@@ -318,6 +321,7 @@
styles={styles}
dispatchActionPromise={dispatchActionPromise}
changeThreadSettings={callChangeThreadSettings}
+ canEditThreadDescription={canEditThreadDescription}
/>
);
});
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Nov 27, 5:57 PM (19 h, 6 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2591258
Default Alt Text
D11754.diff (2 KB)
Attached To
Mode
D11754: [native] Replace `threadHasPermission` with `useThreadHasPermission` in `ThreadSettings`
Attached
Detach File
Event Timeline
Log In to Comment