Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 818e829

Browse files
weeman1337t3chguy
andauthored
Fix send two join requests when joining a room from spotlight search (#10534)
* Fix send two join requests when joining a room from spotlight search * Trigger CI --------- Co-authored-by: Michael Telatynski <[email protected]>
1 parent b730321 commit 818e829

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

Diff for: src/components/views/dialogs/spotlight/SpotlightDialog.tsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright 2021-2022 The Matrix.org Foundation C.I.C.
2+
Copyright 2021 - 2023 The Matrix.org Foundation C.I.C.
33
44
Licensed under the Apache License, Version 2.0 (the "License");
55
you may not use this file except in compliance with the License.
@@ -624,6 +624,8 @@ const SpotlightDialog: React.FC<IProps> = ({ initialText = "", initialFilter = n
624624
clientRoom?.getMyMembership() === "join" || result.publicRoom.world_readable || cli.isGuest();
625625

626626
const listener = (ev: ButtonEvent): void => {
627+
ev.stopPropagation();
628+
627629
const { publicRoom } = result;
628630
viewRoom(
629631
{

Diff for: test/components/views/dialogs/SpotlightDialog-test.tsx

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright 2022 The Matrix.org Foundation C.I.C.
2+
Copyright 2022 - 2023 The Matrix.org Foundation C.I.C.
33
44
Licensed under the Apache License, Version 2.0 (the "License");
55
you may not use this file except in compliance with the License.
@@ -376,7 +376,8 @@ describe("Spotlight Dialog", () => {
376376
expect(options.length).toBe(1);
377377
expect(options[0].innerHTML).toContain(testPublicRoom.name);
378378

379-
fireEvent.click(options[0]!);
379+
fireEvent.click(options[0].querySelector("[role='button']")!);
380+
expect(defaultDispatcher.dispatch).toHaveBeenCalledTimes(1);
380381
expect(defaultDispatcher.dispatch).toHaveBeenCalledWith(
381382
expect.objectContaining({
382383
action: "view_room",

0 commit comments

Comments
 (0)