From 1207203b00857b9fda94e255c0414ee3a63626ab Mon Sep 17 00:00:00 2001 From: Danila Fedorin Date: Fri, 30 Jul 2021 14:53:00 -0700 Subject: [PATCH] Prefer relations from encrypted content --- src/matrix/room/timeline/entries/EventEntry.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/matrix/room/timeline/entries/EventEntry.js b/src/matrix/room/timeline/entries/EventEntry.js index f98801f9..55219cd6 100644 --- a/src/matrix/room/timeline/entries/EventEntry.js +++ b/src/matrix/room/timeline/entries/EventEntry.js @@ -16,7 +16,7 @@ limitations under the License. import {BaseEventEntry} from "./BaseEventEntry.js"; import {getPrevContentFromStateEvent, isRedacted} from "../../common.js"; -import {getRelatedEventId} from "../relations.js"; +import {getRelationFromContent, getRelatedEventId} from "../relations.js"; export class EventEntry extends BaseEventEntry { constructor(eventEntry, fragmentIdComparer) { @@ -139,6 +139,12 @@ export class EventEntry extends BaseEventEntry { get annotations() { return this._eventEntry.annotations; } + + get relation() { + const originalContent = this._eventEntry.event.content; + const originalRelation = originalContent && getRelationFromContent(originalContent); + return originalRelation || getRelationFromContent(this.content); + } } import {withTextBody, withContent, createEvent} from "../../../../mocks/event.js";