Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3174376
D3794.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D3794.diff
View Options
diff --git a/web/modals/threads/thread-settings-modal.react.js b/web/modals/threads/thread-settings-modal.react.js
--- a/web/modals/threads/thread-settings-modal.react.js
+++ b/web/modals/threads/thread-settings-modal.react.js
@@ -102,6 +102,7 @@
+onChangeAccountPassword: (event: SyntheticEvent<HTMLInputElement>) => void,
+hasPermissionForTab: (thread: ThreadInfo, tab: TabType) => boolean,
+deleteThreadAction: () => Promise<LeaveThreadPayload>,
+ +onDelete: (event: SyntheticEvent<HTMLElement>) => void,
};
class ThreadSettingsModal extends React.PureComponent<Props> {
nameInput: ?HTMLInputElement;
@@ -189,7 +190,7 @@
if (this.props.currentTabType === 'delete') {
buttons = (
<Button
- onClick={this.onDelete}
+ onClick={this.props.onDelete}
variant="danger"
disabled={inputDisabled}
>
@@ -312,14 +313,6 @@
throw e;
}
}
-
- onDelete = (event: SyntheticEvent<HTMLElement>) => {
- event.preventDefault();
- this.props.dispatchActionPromise(
- deleteThreadActionTypes,
- this.props.deleteThreadAction(),
- );
- };
}
const deleteThreadLoadingStatusSelector = createLoadingStatusSelector(
@@ -472,6 +465,14 @@
}
}, [accountPassword, callDeleteThread, modalContext, threadInfo]);
+ const onDelete = React.useCallback(
+ (event: SyntheticEvent<HTMLElement>) => {
+ event.preventDefault();
+ dispatchActionPromise(deleteThreadActionTypes, deleteThreadAction());
+ },
+ [deleteThreadAction, dispatchActionPromise],
+ );
+
if (!threadInfo) {
return (
<Modal onClose={modalContext.clearModal} name="Invalid thread">
@@ -510,6 +511,7 @@
onChangeAccountPassword={onChangeAccountPassword}
hasPermissionForTab={hasPermissionForTab}
deleteThreadAction={deleteThreadAction}
+ onDelete={onDelete}
/>
);
},
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Nov 8, 4:24 PM (20 h, 46 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2444562
Default Alt Text
D3794.diff (1 KB)
Attached To
Mode
D3794: [web] Move `onDelete` up from `ThreadSettingsModal` to `ConnectedThreadSettingsModal`
Attached
Detach File
Event Timeline
Log In to Comment