Update history visibility UX (#31635)
* Update history visibility UX * don't change voip strings
This commit is contained in:
@@ -377,6 +377,76 @@ describe("<SecurityRoomSettingsTab />", () => {
|
||||
expect(screen.getByDisplayValue(HistoryVisibility.Shared)).toBeChecked();
|
||||
expect(logger.error).toHaveBeenCalledWith("oups");
|
||||
});
|
||||
|
||||
it("maps 'joined' history visibility to 'invited' for display", () => {
|
||||
const room = new Room(roomId, client, userId);
|
||||
setRoomStateEvents(room, undefined, undefined, HistoryVisibility.Joined);
|
||||
|
||||
getComponent(room);
|
||||
|
||||
// Should display as 'invited' even though underlying value is 'joined'
|
||||
expect(screen.getByDisplayValue(HistoryVisibility.Invited)).toBeChecked();
|
||||
// Should not have a 'joined' option visible
|
||||
expect(screen.queryByDisplayValue(HistoryVisibility.Joined)).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("shows 'invited' option for non-public rooms", () => {
|
||||
const room = new Room(roomId, client, userId);
|
||||
setRoomStateEvents(room, JoinRule.Invite);
|
||||
|
||||
getComponent(room);
|
||||
|
||||
expect(screen.getByDisplayValue(HistoryVisibility.Invited)).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("shows 'invited' option for encrypted rooms even if public", async () => {
|
||||
const room = new Room(roomId, client, userId);
|
||||
jest.spyOn(client.getCrypto()!, "isEncryptionEnabledInRoom").mockResolvedValue(true);
|
||||
setRoomStateEvents(room, JoinRule.Public);
|
||||
|
||||
getComponent(room);
|
||||
|
||||
await waitFor(() => expect(screen.getByDisplayValue(HistoryVisibility.Invited)).toBeInTheDocument());
|
||||
});
|
||||
|
||||
it("does not show 'invited' option for public unencrypted rooms unless selected", async () => {
|
||||
const room = new Room(roomId, client, userId);
|
||||
setRoomStateEvents(room, JoinRule.Public, undefined, HistoryVisibility.Shared);
|
||||
|
||||
getComponent(room);
|
||||
|
||||
await waitFor(() => expect(screen.queryByDisplayValue(HistoryVisibility.Invited)).not.toBeInTheDocument());
|
||||
});
|
||||
|
||||
it("shows 'world_readable' option for public unencrypted rooms", async () => {
|
||||
const room = new Room(roomId, client, userId);
|
||||
setRoomStateEvents(room, JoinRule.Public);
|
||||
|
||||
getComponent(room);
|
||||
|
||||
await waitFor(() => expect(screen.getByDisplayValue(HistoryVisibility.WorldReadable)).toBeInTheDocument());
|
||||
});
|
||||
|
||||
it("does not show 'world_readable' option for private encrypted rooms unless selected", async () => {
|
||||
const room = new Room(roomId, client, userId);
|
||||
jest.spyOn(client.getCrypto()!, "isEncryptionEnabledInRoom").mockResolvedValue(true);
|
||||
setRoomStateEvents(room, JoinRule.Invite);
|
||||
|
||||
getComponent(room);
|
||||
|
||||
await waitFor(() =>
|
||||
expect(screen.queryByDisplayValue(HistoryVisibility.WorldReadable)).not.toBeInTheDocument(),
|
||||
);
|
||||
});
|
||||
|
||||
it("always shows 'shared' option", () => {
|
||||
const room = new Room(roomId, client, userId);
|
||||
setRoomStateEvents(room);
|
||||
|
||||
getComponent(room);
|
||||
|
||||
expect(screen.getByDisplayValue(HistoryVisibility.Shared)).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
||||
describe("encryption", () => {
|
||||
|
||||
@@ -15,7 +15,32 @@ exports[`<SecurityRoomSettingsTab /> history visibility uses shared as default h
|
||||
<div
|
||||
class="mx_SettingsSubsection_text"
|
||||
>
|
||||
The visibility of existing history will not be changed.
|
||||
<span>
|
||||
Changes won't affect past messages, only new ones.
|
||||
<a
|
||||
class="mx_ExternalLink"
|
||||
href="https://element.io/en/help#e2ee-history-sharing"
|
||||
rel="noreferrer noopener"
|
||||
target="_blank"
|
||||
>
|
||||
Learn more
|
||||
<svg
|
||||
class="mx_ExternalLink_icon"
|
||||
fill="currentColor"
|
||||
height="1em"
|
||||
viewBox="0 0 24 24"
|
||||
width="1em"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
>
|
||||
<path
|
||||
d="M5 3h6a1 1 0 1 1 0 2H5v14h14v-6a1 1 0 1 1 2 0v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2"
|
||||
/>
|
||||
<path
|
||||
d="M15 3h5a1 1 0 0 1 1 1v5a1 1 0 1 1-2 0V6.414l-6.293 6.293a1 1 0 0 1-1.414-1.414L17.586 5H15a1 1 0 1 1 0-2"
|
||||
/>
|
||||
</svg>
|
||||
</a>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
@@ -25,10 +50,10 @@ exports[`<SecurityRoomSettingsTab /> history visibility uses shared as default h
|
||||
class="mx_StyledRadioButton mx_StyledRadioButton_enabled"
|
||||
>
|
||||
<input
|
||||
id="historyVis-world_readable"
|
||||
id="historyVis-invited"
|
||||
name="historyVis"
|
||||
type="radio"
|
||||
value="world_readable"
|
||||
value="invited"
|
||||
/>
|
||||
<div>
|
||||
<div />
|
||||
@@ -36,7 +61,7 @@ exports[`<SecurityRoomSettingsTab /> history visibility uses shared as default h
|
||||
<div
|
||||
class="mx_StyledRadioButton_content"
|
||||
>
|
||||
Anyone
|
||||
Members since invited
|
||||
</div>
|
||||
<div
|
||||
class="mx_StyledRadioButton_spacer"
|
||||
@@ -58,49 +83,7 @@ exports[`<SecurityRoomSettingsTab /> history visibility uses shared as default h
|
||||
<div
|
||||
class="mx_StyledRadioButton_content"
|
||||
>
|
||||
Members only (since the point in time of selecting this option)
|
||||
</div>
|
||||
<div
|
||||
class="mx_StyledRadioButton_spacer"
|
||||
/>
|
||||
</label>
|
||||
<label
|
||||
class="mx_StyledRadioButton mx_StyledRadioButton_enabled"
|
||||
>
|
||||
<input
|
||||
id="historyVis-invited"
|
||||
name="historyVis"
|
||||
type="radio"
|
||||
value="invited"
|
||||
/>
|
||||
<div>
|
||||
<div />
|
||||
</div>
|
||||
<div
|
||||
class="mx_StyledRadioButton_content"
|
||||
>
|
||||
Members only (since they were invited)
|
||||
</div>
|
||||
<div
|
||||
class="mx_StyledRadioButton_spacer"
|
||||
/>
|
||||
</label>
|
||||
<label
|
||||
class="mx_StyledRadioButton mx_StyledRadioButton_enabled"
|
||||
>
|
||||
<input
|
||||
id="historyVis-joined"
|
||||
name="historyVis"
|
||||
type="radio"
|
||||
value="joined"
|
||||
/>
|
||||
<div>
|
||||
<div />
|
||||
</div>
|
||||
<div
|
||||
class="mx_StyledRadioButton_content"
|
||||
>
|
||||
Members only (since they joined)
|
||||
Members (full history)
|
||||
</div>
|
||||
<div
|
||||
class="mx_StyledRadioButton_spacer"
|
||||
|
||||
Reference in New Issue
Block a user