Fix room joining over federation not specifying vias or using aliases (#30641)
* Fix room joining over federation not specifying vias or using aliases Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Be consistent with viaServers Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Simplify modules Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Only consider canAskToJoin on 403 as per spec Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Remove unused helper which I only just added =( Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Update tests Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Add tests Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Add test Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Add tests Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --------- Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
committed by
GitHub
parent
1b4a979b6c
commit
8fa3d7e4b7
@@ -24,6 +24,7 @@ import defaultDispatcher from "../../../src/dispatcher/dispatcher";
|
||||
import { Action } from "../../../src/dispatcher/actions";
|
||||
import WidgetStore, { type IApp } from "../../../src/stores/WidgetStore";
|
||||
import { Container, WidgetLayoutStore } from "../../../src/stores/widgets/WidgetLayoutStore";
|
||||
import * as navigator from "../../../src/utils/permalinks/navigator.ts";
|
||||
|
||||
describe("ProxiedApiModule", () => {
|
||||
afterEach(() => {
|
||||
@@ -361,4 +362,30 @@ describe("ProxiedApiModule", () => {
|
||||
expect(WidgetLayoutStore.instance.moveToContainer).toHaveBeenCalledWith(room, app, Container.Top);
|
||||
});
|
||||
});
|
||||
|
||||
describe("navigatePermalink", () => {
|
||||
const api = new ProxiedModuleApi();
|
||||
|
||||
it("should call navigateToPermalink with the correct parameters", async () => {
|
||||
const link = "https://matrix.to/#/!roomId:server.com";
|
||||
const spy = jest.spyOn(navigator, "navigateToPermalink");
|
||||
|
||||
await api.navigatePermalink(link);
|
||||
expect(spy).toHaveBeenCalledWith(link);
|
||||
});
|
||||
|
||||
it("should set auto_join to true when join=true", async () => {
|
||||
const link = "https://matrix.to/#/#alias:server.com";
|
||||
const spy = jest.spyOn(defaultDispatcher, "dispatch");
|
||||
|
||||
await api.navigatePermalink(link, true);
|
||||
expect(spy).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
action: "view_room",
|
||||
room_alias: "#alias:server.com",
|
||||
auto_join: true,
|
||||
}),
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user