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

Fix thread & main timeline partitioning logic (#2264)

This commit is contained in:
Michael Telatynski
2022-03-31 13:57:37 +01:00
committed by GitHub
parent 4360ae7ff8
commit d6f1c6cfdc
11 changed files with 1251 additions and 1054 deletions

View File

@@ -1,4 +1,5 @@
import {
MatrixEvent,
RelationType,
} from "../../src";
import { FilterComponent } from "../../src/filter-component";
@@ -13,7 +14,7 @@ describe("Filter Component", function() {
content: { },
room: 'roomId',
event: true,
});
}) as MatrixEvent;
const checkResult = filter.check(event);
@@ -27,7 +28,7 @@ describe("Filter Component", function() {
content: { },
room: 'roomId',
event: true,
});
}) as MatrixEvent;
const checkResult = filter.check(event);
@@ -54,7 +55,7 @@ describe("Filter Component", function() {
},
},
},
});
}) as MatrixEvent;
expect(filter.check(threadRootNotParticipated)).toBe(false);
});
@@ -79,7 +80,7 @@ describe("Filter Component", function() {
user: '@someone-else:server.org',
room: 'roomId',
event: true,
});
}) as MatrixEvent;
expect(filter.check(threadRootParticipated)).toBe(true);
});
@@ -99,7 +100,7 @@ describe("Filter Component", function() {
[RelationType.Reference]: {},
},
},
});
}) as MatrixEvent;
expect(filter.check(referenceRelationEvent)).toBe(false);
});
@@ -122,7 +123,7 @@ describe("Filter Component", function() {
},
room: 'roomId',
event: true,
});
}) as MatrixEvent;
const eventWithMultipleRelations = mkEvent({
"type": "m.room.message",
@@ -147,7 +148,7 @@ describe("Filter Component", function() {
},
"room": 'roomId',
"event": true,
});
}) as MatrixEvent;
const noMatchEvent = mkEvent({
"type": "m.room.message",
@@ -159,7 +160,7 @@ describe("Filter Component", function() {
},
"room": 'roomId',
"event": true,
});
}) as MatrixEvent;
expect(filter.check(threadRootEvent)).toBe(true);
expect(filter.check(eventWithMultipleRelations)).toBe(true);