1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-07-30 04:23:07 +03:00

Refactor Relations to not be per-EventTimelineSet (#2412)

* Refactor Relations to not be per-EventTimelineSet

* Fix comment and relations-container init

* Revert timing tweaks

* Fix relations order test

* Add test and simplify thread relations handling

* Fix order of initialising a room object

* Fix test

* Re-add thread handling for relations of unloaded threads

* Ditch confusing experimental getter `MatrixEvent::isThreadRelation`

* Fix room handling in RelationsContainer

* Iterate PR

* Tweak method naming to closer match spec
This commit is contained in:
Michael Telatynski
2022-06-07 11:16:53 +01:00
committed by GitHub
parent 07189f0637
commit bfed6edf41
11 changed files with 214 additions and 243 deletions

View File

@ -40,8 +40,8 @@ describe('EventTimelineSet', () => {
const itShouldReturnTheRelatedEvents = () => {
it('should return the related events', () => {
eventTimelineSet.aggregateRelations(messageEvent);
const relations = eventTimelineSet.getRelationsForEvent(
eventTimelineSet.relations.aggregateChildEvent(messageEvent);
const relations = eventTimelineSet.relations.getChildEventsForEvent(
messageEvent.getId(),
"m.in_reply_to",
EventType.RoomMessage,
@ -55,9 +55,7 @@ describe('EventTimelineSet', () => {
beforeEach(() => {
client = utils.mock(MatrixClient, 'MatrixClient');
room = new Room(roomId, client, userA);
eventTimelineSet = new EventTimelineSet(room, {
unstableClientRelationAggregation: true,
});
eventTimelineSet = new EventTimelineSet(room);
eventTimeline = new EventTimeline(eventTimelineSet);
messageEvent = utils.mkMessage({
room: roomId,
@ -189,8 +187,8 @@ describe('EventTimelineSet', () => {
});
it('should not return the related events', () => {
eventTimelineSet.aggregateRelations(messageEvent);
const relations = eventTimelineSet.getRelationsForEvent(
eventTimelineSet.relations.aggregateChildEvent(messageEvent);
const relations = eventTimelineSet.relations.getChildEventsForEvent(
messageEvent.getId(),
"m.in_reply_to",
EventType.RoomMessage,