1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-12-05 17:02:07 +03:00

Change to event-level beforeRedaction event for efficiency

To avoid an O(n^2) situation with every relations container trying to process
every redaction that may occur in a room, this switches to an event-level
notification, so that the specific relations container who cares can listen to
just the events it wants to know about.
This commit is contained in:
J. Ryan Stinnett
2019-05-13 14:35:39 +01:00
parent f411d50253
commit 3a20114c39
3 changed files with 7 additions and 6 deletions

View File

@@ -1011,7 +1011,6 @@ Room.prototype._addLiveEvent = function(event, duplicateStrategy) {
// if we know about this event, redact its contents now.
const redactedEvent = this.getUnfilteredTimelineSet().findEventById(redactId);
if (redactedEvent) {
this.emit("Room.beforeRedaction", redactedEvent, event, this);
redactedEvent.makeRedacted(event);
this.emit("Room.redaction", event, this);