use canAccept in tile, which takes local echo into account

pull/21833/head
Bruno Windels 2020-02-13 17:29:13 +01:00
parent 3ec0301f9d
commit 3eb07465f7
1 changed files with 3 additions and 6 deletions

View File

@ -59,7 +59,6 @@ export default class MKeyVerificationRequest extends React.Component {
}; };
_onAcceptClicked = async () => { _onAcceptClicked = async () => {
this.setState({acceptOrCancelClicked: true});
const request = this.props.mxEvent.verificationRequest; const request = this.props.mxEvent.verificationRequest;
if (request) { if (request) {
try { try {
@ -72,7 +71,6 @@ export default class MKeyVerificationRequest extends React.Component {
}; };
_onRejectClicked = async () => { _onRejectClicked = async () => {
this.setState({acceptOrCancelClicked: true});
const request = this.props.mxEvent.verificationRequest; const request = this.props.mxEvent.verificationRequest;
if (request) { if (request) {
try { try {
@ -137,11 +135,10 @@ export default class MKeyVerificationRequest extends React.Component {
_t("%(name)s wants to verify", {name})}</div>); _t("%(name)s wants to verify", {name})}</div>);
subtitle = (<div className="mx_cryptoEvent_subtitle">{ subtitle = (<div className="mx_cryptoEvent_subtitle">{
userLabelForEventRoom(request.requestingUserId, mxEvent.getRoomId())}</div>); userLabelForEventRoom(request.requestingUserId, mxEvent.getRoomId())}</div>);
if (request.requested && !request.observeOnly) { if (request.canAccept) {
const disabled = this.state.acceptOrCancelClicked;
stateNode = (<div className="mx_cryptoEvent_buttons"> stateNode = (<div className="mx_cryptoEvent_buttons">
<FormButton disabled={disabled} kind="danger" onClick={this._onRejectClicked} label={_t("Decline")} /> <FormButton kind="danger" onClick={this._onRejectClicked} label={_t("Decline")} />
<FormButton disabled={disabled} onClick={this._onAcceptClicked} label={_t("Accept")} /> <FormButton onClick={this._onAcceptClicked} label={_t("Accept")} />
</div>); </div>);
} }
} else { // request sent by us } else { // request sent by us