Prefer relations from encrypted content

This commit is contained in:
Danila Fedorin 2021-07-30 14:53:00 -07:00
parent 5a0bc55e54
commit 1207203b00

View file

@ -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";