Update history visibility UX (#31635)
* Update history visibility UX * don't change voip strings
This commit is contained in:
@@ -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}
|
||||
|
||||
Reference in New Issue
Block a user