Render reason for invite rejection. (#29257)

* Render reason for invite rejection.

* Add test

* extra test
This commit is contained in:
Will Hunt
2025-02-14 10:58:20 +00:00
committed by GitHub
parent f9a85d37fa
commit c47ce59478
3 changed files with 48 additions and 1 deletions

View File

@@ -519,6 +519,49 @@ describe("TextForEvent", () => {
),
).toMatchInlineSnapshot(`"Andy changed their display name and profile picture"`);
});
it("should handle rejected invites", () => {
expect(
textForEvent(
new MatrixEvent({
type: "m.room.member",
sender: "@a:foo",
content: {
membership: KnownMembership.Leave,
},
unsigned: {
prev_content: {
membership: KnownMembership.Invite,
},
},
state_key: "@a:foo",
}),
mockClient,
),
).toMatchInlineSnapshot(`"Member rejected the invitation"`);
});
it("should handle rejected invites with a reason", () => {
expect(
textForEvent(
new MatrixEvent({
type: "m.room.member",
sender: "@a:foo",
content: {
membership: KnownMembership.Leave,
reason: "I don't want to be in this room.",
},
unsigned: {
prev_content: {
membership: KnownMembership.Invite,
},
},
state_key: "@a:foo",
}),
mockClient,
),
).toMatchInlineSnapshot(`"Member rejected the invitation: I don't want to be in this room."`);
});
});
describe("textForJoinRulesEvent()", () => {