1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-26 17:03:12 +03:00
This commit is contained in:
Travis Ralston
2021-07-14 10:18:12 -06:00
parent ea4dfd003f
commit 11dabf9a68

View File

@@ -263,11 +263,11 @@ export class MatrixEvent extends EventEmitter {
} }
/** /**
* Gets the clear event as it would be received over the wire. If the event * Gets the event as though it would appear unencrypted. If the event is already not
* is not encrypted, this simply returns the event as-is. * encrypted, it is simply returned as-is.
* @returns {IEvent} The clear event, as known by the SDK. * @returns {IEvent} The event in wire format.
*/ */
public getClearEvent(): IEvent { public getEffectiveEvent(): IEvent {
// clearEvent doesn't have all the fields, so we'll copy what we can from this.event // clearEvent doesn't have all the fields, so we'll copy what we can from this.event
return Object.assign({}, this.event, this.clearEvent) as IEvent; return Object.assign({}, this.event, this.clearEvent) as IEvent;
} }
@@ -1240,15 +1240,7 @@ export class MatrixEvent extends EventEmitter {
* @return {Object} * @return {Object}
*/ */
public toJSON(): object { public toJSON(): object {
const event: any = { const event = this.getEffectiveEvent();
type: this.getType(),
sender: this.getSender(),
content: this.getContent(),
event_id: this.getId(),
origin_server_ts: this.getTs(),
unsigned: this.getUnsigned(),
room_id: this.getRoomId(),
};
// if this is a redaction then attach the redacts key // if this is a redaction then attach the redacts key
if (this.isRedaction()) { if (this.isRedaction()) {