mirror of
https://github.com/vector-im/element-web.git
synced 2024-11-17 14:05:04 +08:00
disable "Accept"/"Decline" buttons on verif tile after clicking
to avoid sending double events
This commit is contained in:
parent
720450f372
commit
413a149b47
@ -27,6 +27,7 @@ import {RIGHT_PANEL_PHASES} from "../../../stores/RightPanelStorePhases";
|
||||
export default class MKeyVerificationRequest extends React.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {};
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
@ -58,6 +59,7 @@ export default class MKeyVerificationRequest extends React.Component {
|
||||
};
|
||||
|
||||
_onAcceptClicked = async () => {
|
||||
this.setState({acceptOrCancelClicked: true});
|
||||
const request = this.props.mxEvent.verificationRequest;
|
||||
if (request) {
|
||||
try {
|
||||
@ -70,6 +72,7 @@ export default class MKeyVerificationRequest extends React.Component {
|
||||
};
|
||||
|
||||
_onRejectClicked = async () => {
|
||||
this.setState({acceptOrCancelClicked: true});
|
||||
const request = this.props.mxEvent.verificationRequest;
|
||||
if (request) {
|
||||
try {
|
||||
@ -135,9 +138,10 @@ export default class MKeyVerificationRequest extends React.Component {
|
||||
subtitle = (<div className="mx_cryptoEvent_subtitle">{
|
||||
userLabelForEventRoom(request.requestingUserId, mxEvent.getRoomId())}</div>);
|
||||
if (request.requested && !request.observeOnly) {
|
||||
const disabled = this.state.acceptOrCancelClicked;
|
||||
stateNode = (<div className="mx_cryptoEvent_buttons">
|
||||
<FormButton kind="danger" onClick={this._onRejectClicked} label={_t("Decline")} />
|
||||
<FormButton onClick={this._onAcceptClicked} label={_t("Accept")} />
|
||||
<FormButton disabled={disabled} kind="danger" onClick={this._onRejectClicked} label={_t("Decline")} />
|
||||
<FormButton disabled={disabled} onClick={this._onAcceptClicked} label={_t("Accept")} />
|
||||
</div>);
|
||||
}
|
||||
} else { // request sent by us
|
||||
|
Loading…
Reference in New Issue
Block a user