render done and cancel event as conclusion tile

don't render any done events not sent by us, as
done events are sent by both parties and we don't want
to render two conclusion tiles.

cancel events should be only sent by one party.
This commit is contained in:
Bruno Windels 2019-11-07 17:43:50 +01:00
parent 9d67fa9fa1
commit d7f5252f9a

View file

@ -40,6 +40,8 @@ const ObjectUtils = require('../../../ObjectUtils');
const eventTileTypes = { const eventTileTypes = {
'm.room.message': 'messages.MessageEvent', 'm.room.message': 'messages.MessageEvent',
'm.sticker': 'messages.MessageEvent', 'm.sticker': 'messages.MessageEvent',
'm.key.verification.cancel': 'messages.MKeyVerificationConclusion',
'm.key.verification.done': 'messages.MKeyVerificationConclusion',
'm.call.invite': 'messages.TextualEvent', 'm.call.invite': 'messages.TextualEvent',
'm.call.answer': 'messages.TextualEvent', 'm.call.answer': 'messages.TextualEvent',
'm.call.hangup': 'messages.TextualEvent', 'm.call.hangup': 'messages.TextualEvent',
@ -84,6 +86,16 @@ function getHandlerTile(ev) {
} }
} }
} }
// these events are sent by both parties during verification, but we only want to render one
// tile once the verification concludes, so filter out the one from the other party.
if (type === "m.key.verification.done") {
const client = MatrixClientPeg.get();
const me = client && client.getUserId();
if (ev.getSender() !== me) {
return undefined;
}
}
return ev.isState() ? stateEventTileTypes[type] : eventTileTypes[type]; return ev.isState() ? stateEventTileTypes[type] : eventTileTypes[type];
} }