-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Update for compatibility with v12 rooms #30452
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 12 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
3eca1de
Update for compatibility with v12 rooms
dbkr ddbf88a
Merge remote-tracking branch 'origin/develop' into dbkr/hydra
dbkr c42ba2a
Merge branch 'develop' into dbkr/hydra
dbkr dd0b7a9
Add test for leave space dialog
dbkr 56b34de
Don't compute stuff if we don't need it
dbkr c63e619
Use room.client
dbkr f646164
Use getSafeUserId
dbkr bc2cb7a
Remove client arg
dbkr 76abd06
Use getJoinedMembers
dbkr 6ea1786
Fix tests
dbkr 823034c
Fix more tests
dbkr 853550c
Fix other test
dbkr 0ccbac2
Clarify comment
dbkr File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
test/unit-tests/components/views/dialogs/LeaveSpaceDialog-test.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| /* | ||
| Copyright 2025 New Vector Ltd. | ||
|
|
||
| SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Commercial | ||
| Please see LICENSE files in the repository root for full details. | ||
| */ | ||
|
|
||
| import React from "react"; | ||
| import { render, screen } from "jest-matrix-react"; | ||
| import { MatrixEvent, type RoomMember } from "matrix-js-sdk/src/matrix"; | ||
|
|
||
| import LeaveSpaceDialog from "../../../../../src/components/views/dialogs/LeaveSpaceDialog"; | ||
| import { createTestClient, mkStubRoom } from "../../../../test-utils"; | ||
|
|
||
| describe("LeaveSpaceDialog", () => { | ||
| it("should warn about not being able to rejoin non-public space", () => { | ||
| const mockClient = createTestClient(); | ||
| const mockSpace = mkStubRoom("myfakeroom", "myfakeroom", mockClient) as any; | ||
| jest.spyOn(mockSpace.currentState, "getStateEvents").mockReturnValue( | ||
| new MatrixEvent({ | ||
| type: "m.room.join_rules", | ||
| content: { | ||
| join_rule: "invite", | ||
| }, | ||
| }), | ||
| ); | ||
|
|
||
| render(<LeaveSpaceDialog space={mockSpace} onFinished={jest.fn()} />); | ||
|
|
||
| expect(screen.getByText(/You won't be able to rejoin unless you are re-invited/)).toBeInTheDocument(); | ||
| }); | ||
|
|
||
| it("should warn if user is the only admin", () => { | ||
| const mockClient = createTestClient(); | ||
| const mockSpace = mkStubRoom("myfakeroom", "myfakeroom", mockClient) as any; | ||
| jest.spyOn(mockSpace, "getJoinedMembers").mockReturnValue([ | ||
| { powerLevel: 100 } as unknown as RoomMember, | ||
| { powerLevel: 0 } as unknown as RoomMember, | ||
| ]); | ||
| jest.spyOn(mockSpace, "getMember").mockReturnValue({ | ||
| powerLevel: 100, | ||
| } as unknown as RoomMember); | ||
|
|
||
| render(<LeaveSpaceDialog space={mockSpace} onFinished={jest.fn()} />); | ||
|
|
||
| expect( | ||
| screen.getByText(/You're the only admin of this space. Leaving it will mean no one has control over it./), | ||
| ).toBeInTheDocument(); | ||
| }); | ||
| }); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.