Skip to content

Commit

Permalink
Add Event.relationsCreated event to listen for future relations col…
Browse files Browse the repository at this point in the history
…lections

If you ask for relations but none currently exist, we return `null` to avoid the
overhead of many empty relations objects in memory. However, we still want some
way to alert consumers when one _is_ later made, so this event level event
provides that.

Part of element-hq/element-web#9572
Part of element-hq/element-web#9485
  • Loading branch information
jryans committed May 10, 2019
1 parent 54f2ff6 commit 6ac3b20
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/models/event-timeline-set.js
Original file line number Diff line number Diff line change
Expand Up @@ -746,6 +746,10 @@ EventTimelineSet.prototype._aggregateRelations = function(event) {
eventType,
this.room,
);
const relatesToEvent = this.findEventById(relatesToEventId);
if (relatesToEvent) {
relatesToEvent.emit("Event.relationsCreated", relationType, eventType);
}
}

relationsWithEventType.addEvent(event);
Expand Down

0 comments on commit 6ac3b20

Please sign in to comment.