From 83337eee574a1861993b5a0e767a7f7285fba02c Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Tue, 13 Jul 2021 23:09:37 -0600 Subject: [PATCH] Expose MatrixEvent's internal clearEvent as a function --- src/models/event.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/models/event.ts b/src/models/event.ts index 9050f4440..922490363 100644 --- a/src/models/event.ts +++ b/src/models/event.ts @@ -262,6 +262,15 @@ export class MatrixEvent extends EventEmitter { this.localTimestamp = Date.now() - this.getAge(); } + /** + * Gets the clear event as it would be received over the wire. If the event + * is not encrypted, this simply returns the event as-is. + * @returns {Partial} The clear event, as known by the SDK. + */ + public getClearEvent(): Partial { + return this.clearEvent ?? this.event; + } + /** * Get the event_id for this event. * @return {string} The event ID, e.g. $143350589368169JsLZx:localhost