Page MenuHomePhabricator

D3757.id11555.diff
No OneTemporary

D3757.id11555.diff

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
@@ -88,10 +88,11 @@
+onClose: () => void,
+errorMessage: string,
+setErrorMessage: SetState<string>,
+ +accountPassword: string,
+ +setAccountPassword: SetState<string>,
};
type State = {
+queuedChanges: ThreadChanges,
- +accountPassword: string,
+currentTabType: TabType,
};
class ThreadSettingsModal extends React.PureComponent<Props, State> {
@@ -102,7 +103,6 @@
super(props);
this.state = {
queuedChanges: Object.freeze({}),
- accountPassword: '',
currentTabType: 'general',
};
}
@@ -210,7 +210,7 @@
} else if (this.state.currentTabType === 'delete') {
mainContent = (
<ThreadSettingsDeleteTab
- accountPassword={this.state.accountPassword}
+ accountPassword={this.props.accountPassword}
onChangeAccountPassword={this.onChangeAccountPassword}
inputDisabled={inputDisabled}
accountPasswordInputRef={this.accountPasswordInputRef}
@@ -370,7 +370,7 @@
onChangeAccountPassword = (event: SyntheticEvent<HTMLInputElement>) => {
const target = event.currentTarget;
- this.setState({ accountPassword: target.value });
+ this.props.setAccountPassword(target.value);
};
onSubmit = (event: SyntheticEvent<HTMLElement>) => {
@@ -391,11 +391,11 @@
return response;
} catch (e) {
this.props.setErrorMessage('unknown error');
+ this.props.setAccountPassword('');
this.setState(
prevState => ({
...prevState,
queuedChanges: Object.freeze({}),
- accountPassword: '',
currentTabType: 'general',
}),
() => {
@@ -419,7 +419,7 @@
try {
const response = await this.props.deleteThread(
this.props.threadInfo.id,
- this.state.accountPassword,
+ this.props.accountPassword,
);
this.props.onClose();
return response;
@@ -429,18 +429,9 @@
? 'wrong password'
: 'unknown error';
this.props.setErrorMessage(errorMessage);
- this.setState(
- {
- accountPassword: '',
- },
- () => {
- invariant(
- this.accountPasswordInput,
- 'accountPasswordInput ref unset',
- );
- this.accountPasswordInput.focus();
- },
- );
+ this.props.setAccountPassword('');
+ invariant(this.accountPasswordInput, 'accountPasswordInput ref unset');
+ this.accountPasswordInput.focus();
throw e;
}
}
@@ -472,6 +463,7 @@
);
const modalContext = useModalContext();
const [errorMessage, setErrorMessage] = React.useState('');
+ const [accountPassword, setAccountPassword] = React.useState('');
if (!threadInfo) {
return (
@@ -496,6 +488,8 @@
onClose={modalContext.clearModal}
errorMessage={errorMessage}
setErrorMessage={setErrorMessage}
+ accountPassword={accountPassword}
+ setAccountPassword={setAccountPassword}
/>
);
},

File Metadata

Mime Type
text/plain
Expires
Fri, Sep 20, 2:12 PM (21 h, 14 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2147588
Default Alt Text
D3757.id11555.diff (3 KB)

Event Timeline