Skip to content

Commit b85d74b

Browse files
committed
Revert "[terms/dashboard] avoid resubmitting twice"
This reverts commit 2787b00.
1 parent 6b3ebe0 commit b85d74b

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

components/dashboard/src/components/tos/terms-of-service.tsx

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,9 @@ export interface TermsOfServiceProps {
2525
}
2626
interface TermsOfServiceState {
2727
isUpdate: boolean;
28-
flowId: string;
2928
userInfo?: any;
3029
terms?: Terms;
3130
acceptsTos: boolean;
32-
submitted: boolean;
3331
}
3432
export class TermsOfService extends React.Component<TermsOfServiceProps, TermsOfServiceState> {
3533
protected gitpodHost = new GitpodHostUrl(window.location.href);
@@ -40,9 +38,7 @@ export class TermsOfService extends React.Component<TermsOfServiceProps, TermsOf
4038
super(props);
4139
this.state = {
4240
isUpdate: false,
43-
acceptsTos: false,
44-
submitted: false,
45-
flowId: "ignore",
41+
acceptsTos: false
4642
};
4743
this.formRef = React.createRef();
4844
this.onDecline = this.onDecline.bind(this);
@@ -57,7 +53,6 @@ export class TermsOfService extends React.Component<TermsOfServiceProps, TermsOf
5753
const tosHints = Cookies.getJSON('tosHints');
5854
this.setState({
5955
isUpdate: tosHints?.isUpdate === true,
60-
flowId: typeof tosHints?.flowId === "string" ? tosHints?.flowId : this.state.flowId,
6156
userInfo: typeof tosHints?.userInfo === "object" ? tosHints?.userInfo : undefined
6257
});
6358
this.props.terms.then(terms => this.setState({ terms }));
@@ -68,10 +63,10 @@ export class TermsOfService extends React.Component<TermsOfServiceProps, TermsOf
6863
}
6964

7065
onAccept() {
71-
this.setState({ acceptsTos: true, submitted: true }, () => this.doSubmit());
66+
this.setState({ acceptsTos: true }, () => this.doSubmit());
7267
}
7368
onDecline() {
74-
this.setState({ acceptsTos: false, submitted: true }, () => this.doSubmit());
69+
this.setState({ acceptsTos: false }, () => this.doSubmit());
7570
}
7671
protected doSubmit() {
7772
this.formRef.current!.submit();
@@ -131,7 +126,6 @@ export class TermsOfService extends React.Component<TermsOfServiceProps, TermsOf
131126
</AppBar>
132127
<div className='content content-area'>
133128
<form ref={this.formRef} action={this.actionUrl} method="post" id="accept-tos-form">
134-
<input type="hidden" id="flowId" name="flowId" value={this.state.flowId} />
135129
<div className="tos-checks">
136130
<Typography className="tos-content" dangerouslySetInnerHTML={{ __html: update ? updateMessage : content }} />
137131
<p>
@@ -154,15 +148,13 @@ export class TermsOfService extends React.Component<TermsOfServiceProps, TermsOf
154148
variant='text'
155149
color={'secondary'}
156150
onClick={this.onDecline}
157-
disabled={this.state.submitted}
158151
data-testid="decline">
159152
{'Decline and log out'}
160153
</ButtonWithProgress>
161154
)}
162155
<ButtonWithProgress
163156
className='button'
164157
onClick={this.onAccept}
165-
disabled={this.state.submitted}
166158
variant='outlined'
167159
color={'primary'}
168160
data-testid="submit">

0 commit comments

Comments
 (0)