render verification request with correct tile

only if the request was send by or to us, otherwise ignore.
This commit is contained in:
Bruno Windels 2019-11-07 17:42:06 +01:00
parent e8c21a341c
commit 9d67fa9fa1

View File

@ -33,6 +33,7 @@ import dis from '../../../dispatcher';
import SettingsStore from "../../../settings/SettingsStore";
import {EventStatus, MatrixClient} from 'matrix-js-sdk';
import {formatTime} from "../../../DateUtils";
import MatrixClientPeg from '../../../MatrixClientPeg';
const ObjectUtils = require('../../../ObjectUtils');
@ -68,6 +69,21 @@ const stateEventTileTypes = {
function getHandlerTile(ev) {
const type = ev.getType();
// don't show verification requests we're not involved in,
// not even when showing hidden events
if (type === "m.room.message") {
const content = ev.getContent();
if (content && content.msgtype === "m.key.verification.request") {
const client = MatrixClientPeg.get();
const me = client && client.getUserId();
if (ev.getSender() !== me && content.to !== me) {
return undefined;
} else {
return "messages.MKeyVerificationRequest";
}
}
}
return ev.isState() ? stateEventTileTypes[type] : eventTileTypes[type];
}