Fix rejoin of knock rooms (#11980)

Signed-off-by: Mikhail Aheichyk <mikhail.aheichyk@nordeck.net>
Co-authored-by: Mikhail Aheichyk <mikhail.aheichyk@nordeck.net>
This commit is contained in:
maheichyk 2023-12-04 13:20:24 +03:00 committed by GitHub
parent e2bc437774
commit 74ea0d134e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 160 additions and 4 deletions

View file

@ -172,7 +172,7 @@ describe("<RoomPreviewBar />", () => {
it("renders kicked message", () => {
const room = createRoom(roomId, otherUserId);
jest.spyOn(room, "getMember").mockReturnValue(makeMockRoomMember({ isKicked: true }));
const component = getComponent({ room, promptAskToJoin: true });
const component = getComponent({ room, canAskToJoinAndMembershipIsLeave: true, promptAskToJoin: false });
expect(getMessage(component)).toMatchSnapshot();
});
@ -458,6 +458,14 @@ describe("<RoomPreviewBar />", () => {
expect(getMessage(component)).toMatchSnapshot();
});
it("renders the corresponding message when kicked", () => {
const room = createRoom(roomId, otherUserId);
jest.spyOn(room, "getMember").mockReturnValue(makeMockRoomMember({ isKicked: true }));
const component = getComponent({ room, promptAskToJoin: true });
expect(getMessage(component)).toMatchSnapshot();
});
it("renders the corresponding message with a generic title", () => {
const component = render(<RoomPreviewBar promptAskToJoin />);
expect(getMessage(component)).toMatchSnapshot();

View file

@ -39,6 +39,31 @@ exports[`<RoomPreviewBar /> message case AskToJoin renders the corresponding mes
</div>
`;
exports[`<RoomPreviewBar /> message case AskToJoin renders the corresponding message when kicked 1`] = `
<div
class="mx_RoomPreviewBar_message"
>
<h3>
Ask to join RoomPreviewBar-test-room?
</h3>
<p>
<span
class="_avatar_1o69u_17 mx_BaseAvatar _avatar-imageless_1o69u_60"
data-color="4"
data-testid="avatar-img"
data-type="round"
role="presentation"
style="--cpd-avatar-size: 36px;"
>
R
</span>
</p>
<p>
You need to be granted access to this room in order to view or participate in the conversation. You can send a request to join below.
</p>
</div>
`;
exports[`<RoomPreviewBar /> message case AskToJoin renders the corresponding message with a generic title 1`] = `
<div
class="mx_RoomPreviewBar_message"