render empty tiles when no request

This commit is contained in:
Bruno Windels 2019-12-20 21:31:36 +01:00
parent 075e42c076
commit b49c471f05
2 changed files with 11 additions and 6 deletions

View file

@ -48,12 +48,14 @@ export default class MKeyVerificationConclusion extends React.Component {
render() { render() {
const {mxEvent} = this.props; const {mxEvent} = this.props;
const request = mxEvent.verificationRequest; const request = mxEvent.verificationRequest;
if (!request) {
return null;
}
const client = MatrixClientPeg.get(); const client = MatrixClientPeg.get();
const myUserId = client.getUserId(); const myUserId = client.getUserId();
if (!request) {
return <p>This is a verification conclusion tile without a request.</p>;
}
let title; let title;
@ -67,6 +69,8 @@ export default class MKeyVerificationConclusion extends React.Component {
title = _t("%(name)s cancelled verifying", title = _t("%(name)s cancelled verifying",
{name: getNameForEventRoom(request.otherUserId, mxEvent)}); {name: getNameForEventRoom(request.otherUserId, mxEvent)});
} }
} else {
title = `request conclusion tile with phase ${request.phase}`;
} }
if (title) { if (title) {

View file

@ -99,13 +99,14 @@ export default class MKeyVerificationRequest extends React.Component {
const {mxEvent} = this.props; const {mxEvent} = this.props;
const request = mxEvent.verificationRequest; const request = mxEvent.verificationRequest;
if (!request) {
return null;
}
let title; let title;
let subtitle; let subtitle;
let stateNode; let stateNode;
if (!request) {
return <p>This is a verification request tile without a request.</p>;
}
if (request.ready || request.started || request.cancelled) { if (request.ready || request.started || request.cancelled) {
let stateLabel; let stateLabel;