mirror of https://github.com/vector-im/riot-web
Avoid `MatrixEvent.toJSON` in event indexer (#11765)
Part of the solution to https://github.com/vector-im/element-web/issues/26380: `toJSON` is dangerous, and I'd like to kill it off. There is no need for it here; it is simpler to call `getEffectiveEvent` directly.pull/28217/head
parent
49cfde82de
commit
a283bc4889
|
@ -309,8 +309,7 @@ export default class EventIndex extends EventEmitter {
|
||||||
}
|
}
|
||||||
|
|
||||||
private eventToJson(ev: MatrixEvent): IEventWithRoomId {
|
private eventToJson(ev: MatrixEvent): IEventWithRoomId {
|
||||||
const jsonEvent: any = ev.toJSON();
|
const e = ev.getEffectiveEvent() as any;
|
||||||
const e = ev.isEncrypted() ? jsonEvent.decrypted : jsonEvent;
|
|
||||||
|
|
||||||
if (ev.isEncrypted()) {
|
if (ev.isEncrypted()) {
|
||||||
// Let us store some additional data so we can re-verify the event.
|
// Let us store some additional data so we can re-verify the event.
|
||||||
|
|
Loading…
Reference in New Issue