Set history visibility to "invited" for DMs and new non-public rooms when creating a room (#31974)

* Set history visibility to "invited" for DMs and non-public rooms

* Update e2e tests and screenshots

* lint

* Revert screenshot

* Add test that an override of historyVisibility still works
This commit is contained in:
David Langley
2026-02-13 14:10:43 +00:00
committed by GitHub
parent 2ff5183806
commit 4912c6e71b
4 changed files with 65 additions and 4 deletions

View File

@@ -38,6 +38,14 @@ test.describe("History sharing", function () {
// Create the room and send a message
await createRoom(alicePage, "TestRoom", true);
// The default history visibility for private rooms is "invited",
// so we need to change it to "shared" to ensure Bob can see the message when he joins.
const roomId = await aliceElementApp.getCurrentRoomIdFromUrl();
await aliceElementApp.client.sendStateEvent(roomId, "m.room.history_visibility", {
history_visibility: "shared",
});
await sendMessageInCurrentRoom(alicePage, "A message from Alice");
// Send the invite to Bob
@@ -101,6 +109,12 @@ test.describe("History sharing", function () {
await bobPage.getByRole("option", { name: "TestRoom" }).click();
await bobPage.getByRole("button", { name: "Accept" }).click();
// The room now defaults to "invited" history visibility, so we need to set it to "shared" first
await aliceElementApp.client.sendStateEvent(roomId, "m.room.history_visibility", {
history_visibility: "shared",
});
await expect(bobPage.getByText("Alice made future room history visible to all room members.")).toBeVisible();
// Bob sends a message with "shared" visibility
await sendMessageInCurrentRoom(bobPage, "Message1: 'shared' visibility");
await expect(alicePage.getByText("Message1")).toBeVisible();

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 27 KiB