Update history visibility UX (#31635)

* Update history visibility UX

* don't change voip strings
This commit is contained in:
David Langley
2026-01-05 12:24:42 +00:00
committed by GitHub
parent 5d1cb24a6c
commit 05e7203f1b
7 changed files with 146 additions and 72 deletions

View File

@@ -419,36 +419,60 @@ export default class SecurityRoomSettingsTab extends React.Component<IProps, ISt
const state = this.props.room.currentState;
const canChangeHistory = state?.mayClientSendStateEvent(EventType.RoomHistoryVisibility, client);
const options = [
{
value: HistoryVisibility.Shared,
label: _t("room_settings|security|history_visibility_shared"),
},
{
// Map 'joined' to 'invited' for display purposes
const displayHistory = history === HistoryVisibility.Joined ? HistoryVisibility.Invited : history;
const isPublicRoom = this.props.room.getJoinRule() === JoinRule.Public;
const isEncrypted = this.state.encrypted;
const options: Array<{ value: HistoryVisibility; label: string }> = [];
// Show "invited" when room's join rule is NOT public OR E2EE is turned on, or if currently selected
if (
!isPublicRoom ||
isEncrypted ||
history === HistoryVisibility.Invited ||
history === HistoryVisibility.Joined
) {
options.push({
value: HistoryVisibility.Invited,
label: _t("room_settings|security|history_visibility_invited"),
},
{
value: HistoryVisibility.Joined,
label: _t("room_settings|security|history_visibility_joined"),
},
];
});
}
// World readable doesn't make sense for encrypted rooms
if (!this.state.encrypted || history === HistoryVisibility.WorldReadable) {
options.unshift({
// Always show "shared" option
options.push({
value: HistoryVisibility.Shared,
label: _t("room_settings|security|history_visibility_shared"),
});
// Show "world_readable" when (is public AND not encrypted) OR currently selected
if ((isPublicRoom && !isEncrypted) || history === HistoryVisibility.WorldReadable) {
options.push({
value: HistoryVisibility.WorldReadable,
label: _t("room_settings|security|history_visibility_world_readable"),
});
}
const description = _t("room_settings|security|history_visibility_warning");
const description = (
<>
{_t(
"room_settings|security|history_visibility_warning",
{},
{
a: (sub) => (
<ExternalLink href="https://element.io/en/help#e2ee-history-sharing">{sub}</ExternalLink>
),
},
)}
</>
);
return (
<SettingsFieldset legend={_t("room_settings|security|history_visibility_legend")} description={description}>
<StyledRadioGroup
name="historyVis"
value={history}
value={displayHistory}
onChange={this.onHistoryRadioToggle}
disabled={!canChangeHistory}
definitions={options}

View File

@@ -2431,12 +2431,11 @@
"error_join_rule_change_title": "Failed to update the join rules",
"error_join_rule_change_unknown": "Unknown failure",
"guest_access_warning": "People with supported clients will be able to join the room without having a registered account.",
"history_visibility_invited": "Members only (since they were invited)",
"history_visibility_joined": "Members only (since they joined)",
"history_visibility_invited": "Members since invited",
"history_visibility_legend": "Who can read history?",
"history_visibility_shared": "Members only (since the point in time of selecting this option)",
"history_visibility_warning": "The visibility of existing history will not be changed.",
"history_visibility_world_readable": "Anyone",
"history_visibility_shared": "Members (full history)",
"history_visibility_warning": "Changes won't affect past messages, only new ones. <a>Learn more</a>",
"history_visibility_world_readable": "Anyone (history is public)\n",
"join_rule_description": "Decide who can join %(roomName)s.",
"join_rule_invite": "Private (invite only)",
"join_rule_invite_description": "Only invited people can join.",