Fix soft crash around inviting invalid MXIDs in start DM on first message flow (#9281)

* Fix soft crash around inviting invalid MXIDs

* Make ts --strict happier

* Prevent suggesting invalid MXIDs

* Add tests

* Fix coverage

* Fix coverage

* Make tsc --strict happier

* Fix test

* Add tests
This commit is contained in:
Michael Telatynski 2022-09-16 09:03:17 +01:00 committed by GitHub
parent 4fec436883
commit 4a23630e06
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 194 additions and 57 deletions

View file

@ -94,6 +94,15 @@ describe('Permalinks', function() {
expect(creator.serverCandidates.length).toBe(0);
});
it('should gracefully handle invalid MXIDs', () => {
const roomId = "!fake:example.org";
const alice50 = makeMemberWithPL(roomId, "@alice:pl_50:org", 50);
const room = mockRoom(roomId, [alice50]);
const creator = new RoomPermalinkCreator(room);
creator.load();
expect(creator.serverCandidates).toBeTruthy();
});
it('should pick a candidate server for the highest power level user in the room', function() {
const roomId = "!fake:example.org";
const alice50 = makeMemberWithPL(roomId, "@alice:pl_50", 50);