1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-12-10 07:22:27 +03:00

detect relations on encrypted events properly

This commit is contained in:
Bruno Windels
2019-05-15 13:56:00 +01:00
parent db7a402e9b
commit 600dff62e8

View File

@@ -747,7 +747,9 @@ utils.extend(module.exports.MatrixEvent.prototype, {
* @return {boolean}
*/
isRelation(relType = undefined) {
const content = this.getContent();
// must use event.content as m.relates_to is not encrypted
// and _clearEvent doesn't have it.
const content = this.event.content;
const relation = content && content["m.relates_to"];
return relation && relation.rel_type && relation.event_id &&
((relType && relation.rel_type === relType) || !relType);