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

Commit

Permalink
Fix send two join requests when joining a room from spotlight search (#…
Browse files Browse the repository at this point in the history
…10534)

* Fix send two join requests when joining a room from spotlight search

* Trigger CI

---------

Co-authored-by: Michael Telatynski <7t3chguy@gmail.com>
  • Loading branch information
weeman1337 and t3chguy authored Apr 6, 2023
1 parent b730321 commit 818e829
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/components/views/dialogs/spotlight/SpotlightDialog.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright 2021-2022 The Matrix.org Foundation C.I.C.
Copyright 2021 - 2023 The Matrix.org Foundation C.I.C.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -624,6 +624,8 @@ const SpotlightDialog: React.FC<IProps> = ({ initialText = "", initialFilter = n
clientRoom?.getMyMembership() === "join" || result.publicRoom.world_readable || cli.isGuest();

const listener = (ev: ButtonEvent): void => {
ev.stopPropagation();

const { publicRoom } = result;
viewRoom(
{
Expand Down
5 changes: 3 additions & 2 deletions test/components/views/dialogs/SpotlightDialog-test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright 2022 The Matrix.org Foundation C.I.C.
Copyright 2022 - 2023 The Matrix.org Foundation C.I.C.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -376,7 +376,8 @@ describe("Spotlight Dialog", () => {
expect(options.length).toBe(1);
expect(options[0].innerHTML).toContain(testPublicRoom.name);

fireEvent.click(options[0]!);
fireEvent.click(options[0].querySelector("[role='button']")!);
expect(defaultDispatcher.dispatch).toHaveBeenCalledTimes(1);
expect(defaultDispatcher.dispatch).toHaveBeenCalledWith(
expect.objectContaining({
action: "view_room",
Expand Down

0 comments on commit 818e829

Please sign in to comment.