Show a tile for an unloaded predecessor room if it has via_servers (#10483)

* Improve typing in constructor of RoomPermalinkCreator

* Provide via servers if present when navigating to predecessor room from Advanced Room Settings

* Show an error tile when the predecessor room is not found

* Test for MatrixToPermalinkConstructor.forRoom

* Test for MatrixToPermalinkConstructor.forEvent

* Display a tile for predecessor event if it contains via servers

* Fix missing case where event id is provided as well as via servers

* Refactor RoomPredecessor tests

* Return lost filterConsole to its home

* Comments for IState in AdvancedRoomSettingsTab

* Explain why we might render a tile even without prevRoom

* Guess the old room's via servers if they are not provided

* Fix TypeScript errors

* Adjust regular expression (hopefully) to avoid potential catastrophic backtracking

* Another attempt at avoiding super-liner regex performance

* Tests for guessServerNameFromRoomId and better implementation

* Further attempt to prevent backtracking

---------

Co-authored-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
Andy Balaam 2023-04-12 16:26:45 +01:00 committed by GitHub
parent 075cb9e622
commit c496985ff3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 320 additions and 89 deletions

View file

@ -47,7 +47,7 @@ describe("AdvancedRoomSettingsTab", () => {
mocked(dis.dispatch).mockReset();
mocked(room.findPredecessor).mockImplementation((msc3946: boolean) =>
msc3946
? { roomId: "old_room_id_via_predecessor" }
? { roomId: "old_room_id_via_predecessor", viaServers: ["one.example.com", "two.example.com"] }
: { roomId: "old_room_id", eventId: "tombstone_event_id" },
);
});
@ -138,6 +138,7 @@ describe("AdvancedRoomSettingsTab", () => {
action: Action.ViewRoom,
event_id: undefined,
room_id: "old_room_id_via_predecessor",
via_servers: ["one.example.com", "two.example.com"],
metricsTrigger: "WebPredecessorSettings",
metricsViaKeyboard: false,
});