Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use semantic headings in user settings Security #10774

Merged
merged 41 commits into from
May 18, 2023
Merged
Show file tree
Hide file tree
Changes from 35 commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
036e1f9
split SettingsSection out of SettingsTab, replace usage
Apr 28, 2023
8e4f061
correct copyright
Apr 28, 2023
77f046e
use semantic headings in GeneralRoomSettingsTab
Apr 28, 2023
2b251b4
use SettingsTab and SettingsSubsection in room settings
Apr 28, 2023
7d94b71
fix VoipRoomSettingsTab
Apr 28, 2023
d011479
Merge branch 'kerry/24922/settings-section-component' into kerry/2492…
Apr 28, 2023
0bf54f3
Merge branch 'develop' into kerry/24922/room-settings-headings
Apr 30, 2023
7354c05
use SettingsSection components in space settings
May 1, 2023
0d0aed5
settingssubsection text component
May 1, 2023
8086361
use semantic headings in HelpUserSetttings tab
May 1, 2023
f7cc24f
use ExternalLink components for external links
May 2, 2023
8e74b74
test
May 2, 2023
4519726
strict
May 2, 2023
74789d9
Merge branch 'develop' into kerry/24932/use-external-link
May 2, 2023
7eca36f
Merge branch 'develop' into kerry/24932/use-external-link
May 3, 2023
9dbe2ce
Merge branch 'kerry/24932/use-external-link' into kerry/24922/user-se…
May 3, 2023
5ff3266
lint
May 3, 2023
fb1ace5
semantic heading in labs settings
May 3, 2023
ea5edeb
semantic headings in keyboard settings tab
May 3, 2023
3a28816
semantic heading in preferencesusersettingstab
May 3, 2023
50d7629
tidying
May 3, 2023
d466887
use new settings components in eventindexpanel
May 3, 2023
953b6db
Merge branch 'develop' into kerry/24922/user-settings-headings-1
May 3, 2023
de109c6
Merge branch 'kerry/24922/user-settings-headings-1' into kerry/24922/…
May 3, 2023
e1d7ab5
Merge branch 'develop' into kerry/24922/user-settings-headings-labs
May 4, 2023
5cf9071
findByTestId
May 4, 2023
6d2d8ca
prettier
May 4, 2023
ff66c05
Merge branch 'kerry/24922/user-settings-headings-labs' into kerry/249…
May 4, 2023
3a78757
semantic headings and style refresh for crypto settings
May 4, 2023
da0cf93
Merge branch 'kerry/24922/user-settings-headings-security' of https:/…
May 4, 2023
7b04972
e2e panel
May 4, 2023
13db734
Merge branch 'develop' into kerry/24922/user-settings-headings-security
May 16, 2023
513ec31
test cross signing panel
May 16, 2023
b7b5bab
strict
May 16, 2023
67bf944
more strict
May 16, 2023
1465fee
Merge branch 'develop' into kerry/24922/user-settings-headings-security
May 17, 2023
5a12bba
Merge branch 'develop' into kerry/24922/user-settings-headings-security
May 17, 2023
2d1c1d1
tweak
May 17, 2023
c1ffdcf
Merge branch 'develop' into kerry/24922/user-settings-headings-security
May 18, 2023
2b58c14
test eventindexpanel
May 18, 2023
77a20ab
strict fixes
May 18, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 8 additions & 11 deletions cypress/e2e/settings/preferences-user-settings-tab.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,16 @@ describe("Preferences user settings tab", () => {
it("should be rendered properly", () => {
cy.openUserSettings("Preferences");

cy.get(".mx_SettingsTab.mx_PreferencesUserSettingsTab").within(() => {
cy.findByTestId("mx_PreferencesUserSettingsTab").within(() => {
// Assert that the top heading is rendered
cy.findByTestId("preferences").should("have.text", "Preferences").should("be.visible");
cy.contains("Preferences").should("be.visible");
});

cy.get(".mx_SettingsTab.mx_PreferencesUserSettingsTab").percySnapshotElement(
"User settings tab - Preferences",
{
// Emulate TabbedView's actual min and max widths
// 580: '.mx_UserSettingsDialog .mx_TabbedView' min-width
// 796: 1036 (mx_TabbedView_tabsOnLeft actual width) - 240 (mx_TabbedView_tabPanel margin-right)
widths: [580, 796],
},
);
cy.findByTestId("mx_PreferencesUserSettingsTab").percySnapshotElement("User settings tab - Preferences", {
// Emulate TabbedView's actual min and max widths
// 580: '.mx_UserSettingsDialog .mx_TabbedView' min-width
// 796: 1036 (mx_TabbedView_tabsOnLeft actual width) - 240 (mx_TabbedView_tabPanel margin-right)
widths: [580, 796],
});
});
});
1 change: 0 additions & 1 deletion res/css/_components.pcss
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,6 @@
@import "./views/settings/tabs/user/_HelpUserSettingsTab.pcss";
@import "./views/settings/tabs/user/_KeyboardUserSettingsTab.pcss";
@import "./views/settings/tabs/user/_MjolnirUserSettingsTab.pcss";
@import "./views/settings/tabs/user/_PreferencesUserSettingsTab.pcss";
@import "./views/settings/tabs/user/_SecurityUserSettingsTab.pcss";
@import "./views/settings/tabs/user/_SidebarUserSettingsTab.pcss";
@import "./views/settings/tabs/user/_VoiceUserSettingsTab.pcss";
Expand Down
8 changes: 2 additions & 6 deletions res/css/views/settings/_CryptographyPanel.pcss
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,9 @@ limitations under the License.
}
}

.mx_CryptographyPanel_importExportButtons .mx_AccessibleButton {
margin-right: 10px;
}

.mx_CryptographyPanel_importExportButtons {
margin-bottom: 15px;
display: inline-flex;
flex-flow: wrap;
row-gap: 10px;
row-gap: $spacing-8;
column-gap: $spacing-8;
}
1 change: 0 additions & 1 deletion res/css/views/settings/tabs/_SettingsTab.pcss
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ limitations under the License.
*/

.mx_SettingsTab {
--SettingsTab_section-margin-bottom-preferences-labs: 30px;
--SettingsTab_heading_nth_child-margin-top: 30px; /* TODO: Use a spacing variable */
--SettingsTab_fullWidthField-margin-inline-end: 100px;
--SettingsTab_tooltip-max-width: 120px; /* So it fits in the space provided by the page */
Expand Down
43 changes: 19 additions & 24 deletions res/css/views/settings/tabs/user/_KeyboardUserSettingsTab.pcss
Original file line number Diff line number Diff line change
Expand Up @@ -15,31 +15,26 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

.mx_KeyboardUserSettingsTab .mx_SettingsTab_section {
ul {
margin: 0;
padding: 0;
}

.mx_KeyboardShortcut_shortcutRow,
.mx_KeyboardShortcut {
display: flex;
justify-content: space-between;
align-items: center;
}
.mx_KeyboardShortcut_shortcutList {
margin: 0;
padding: 0;
width: 100%;
display: grid;
grid-gap: $spacing-4;
}

.mx_KeyboardShortcut_shortcutRow {
column-gap: $spacing-8;
margin-bottom: $spacing-4;
.mx_KeyboardShortcut_shortcutRow,
.mx_KeyboardShortcut {
display: flex;
justify-content: space-between;
align-items: center;
}

/* TODO: Use flexbox */
&:last-of-type {
margin-bottom: 0;
}
.mx_KeyboardShortcut_shortcutRow {
column-gap: $spacing-8;
}

.mx_KeyboardShortcut {
flex-wrap: nowrap;
column-gap: 5px; /* TODO: Use a spacing variable */
}
}
.mx_KeyboardShortcut {
flex-wrap: nowrap;
column-gap: $spacing-4;
}
25 changes: 0 additions & 25 deletions res/css/views/settings/tabs/user/_PreferencesUserSettingsTab.pcss

This file was deleted.

53 changes: 23 additions & 30 deletions res/css/views/settings/tabs/user/_SecurityUserSettingsTab.pcss
Original file line number Diff line number Diff line change
Expand Up @@ -14,43 +14,36 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

.mx_SecurityUserSettingsTab_bulkOptions .mx_AccessibleButton {
margin-right: 10px;
.mx_SecurityUserSettingsTab_bulkOptions {
display: flex;
flex-direction: row;
column-gap: $spacing-8;
}

.mx_SecurityUserSettingsTab_ignoredUser {
margin-bottom: 5px;
margin-bottom: $spacing-4;
}

.mx_SecurityUserSettingsTab_ignoredUser .mx_AccessibleButton {
margin-right: 10px;
margin-right: $spacing-8;
}

.mx_SecurityUserSettingsTab {
.mx_SettingsTab_section {
.mx_AccessibleButton_kind_link {
font-size: inherit;
}
}

.mx_SecurityUserSettingsTab_warning {
color: $alert;
position: relative;
padding-left: 40px;
margin-top: 30px;

&::before {
mask-repeat: no-repeat;
mask-position: 0 center;
mask-size: $font-24px;
position: absolute;
width: $font-24px;
height: $font-24px;
content: "";
top: 0;
left: 0;
background-color: $alert;
mask-image: url("$(res)/img/feather-customised/alert-triangle.svg");
}
.mx_SecurityUserSettingsTab_warning {
color: $alert;
position: relative;
padding-left: 40px;

&::before {
mask-repeat: no-repeat;
mask-position: 0 center;
mask-size: $font-24px;
position: absolute;
width: $font-24px;
height: $font-24px;
content: "";
top: 0;
left: 0;
background-color: $alert;
mask-image: url("$(res)/img/feather-customised/alert-triangle.svg");
}
}
33 changes: 25 additions & 8 deletions src/components/views/settings/CrossSigningPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import ConfirmDestroyCrossSigningDialog from "../dialogs/security/ConfirmDestroy
import SetupEncryptionDialog from "../dialogs/security/SetupEncryptionDialog";
import { accessSecretStorage } from "../../../SecurityManager";
import AccessibleButton from "../elements/AccessibleButton";
import { SettingsSubsectionText } from "./shared/SettingsSubsection";

interface IState {
error?: Error;
Expand Down Expand Up @@ -178,22 +179,38 @@ export default class CrossSigningPanel extends React.PureComponent<{}, IState> {
if (homeserverSupportsCrossSigning === undefined) {
summarisedStatus = <Spinner />;
} else if (!homeserverSupportsCrossSigning) {
summarisedStatus = <p>{_t("Your homeserver does not support cross-signing.")}</p>;
summarisedStatus = (
<SettingsSubsectionText data-testid="summarised-status">
{_t("Your homeserver does not support cross-signing.")}
</SettingsSubsectionText>
);
} else if (crossSigningReady && crossSigningPrivateKeysInStorage) {
summarisedStatus = <p>{_t("Cross-signing is ready for use.")}</p>;
summarisedStatus = (
<SettingsSubsectionText data-testid="summarised-status">
{_t("Cross-signing is ready for use.")}
</SettingsSubsectionText>
);
} else if (crossSigningReady && !crossSigningPrivateKeysInStorage) {
summarisedStatus = <p>⚠️ {_t("Cross-signing is ready but keys are not backed up.")}</p>;
summarisedStatus = (
<SettingsSubsectionText data-testid="summarised-status">
⚠️ {_t("Cross-signing is ready but keys are not backed up.")}
</SettingsSubsectionText>
);
} else if (crossSigningPrivateKeysInStorage) {
summarisedStatus = (
<p>
<SettingsSubsectionText data-testid="summarised-status">
{_t(
"Your account has a cross-signing identity in secret storage, " +
"but it is not yet trusted by this session.",
)}
</p>
</SettingsSubsectionText>
);
} else {
summarisedStatus = <p>{_t("Cross-signing is not set up.")}</p>;
summarisedStatus = (
<SettingsSubsectionText data-testid="summarised-status">
{_t("Cross-signing is not set up.")}
</SettingsSubsectionText>
);
}

const keysExistAnywhere =
Expand Down Expand Up @@ -238,7 +255,7 @@ export default class CrossSigningPanel extends React.PureComponent<{}, IState> {
}

return (
<div>
<>
{summarisedStatus}
<details>
<summary>{_t("Advanced")}</summary>
Expand Down Expand Up @@ -275,7 +292,7 @@ export default class CrossSigningPanel extends React.PureComponent<{}, IState> {
</details>
{errorSection}
{actionRow}
</div>
</>
);
}
}
40 changes: 21 additions & 19 deletions src/components/views/settings/CryptographyPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import * as FormattingUtils from "../../../utils/FormattingUtils";
import SettingsStore from "../../../settings/SettingsStore";
import SettingsFlag from "../elements/SettingsFlag";
import { SettingLevel } from "../../../settings/SettingLevel";
import SettingsSubsection, { SettingsSubsectionText } from "./shared/SettingsSubsection";

interface IProps {}

Expand Down Expand Up @@ -72,27 +73,28 @@ export default class CryptographyPanel extends React.Component<IProps, IState> {
}

return (
<div className="mx_SettingsTab_section mx_CryptographyPanel">
<span className="mx_SettingsTab_subheading">{_t("Cryptography")}</span>
<table className="mx_SettingsTab_subsectionText mx_CryptographyPanel_sessionInfo">
<tr>
<th scope="row">{_t("Session ID:")}</th>
<td>
<code>{deviceId}</code>
</td>
</tr>
<tr>
<th scope="row">{_t("Session key:")}</th>
<td>
<code>
<b>{identityKey}</b>
</code>
</td>
</tr>
</table>
<SettingsSubsection heading={_t("Cryptography")}>
<SettingsSubsectionText>
<table className="mx_CryptographyPanel_sessionInfo">
<tr>
<th scope="row">{_t("Session ID:")}</th>
<td>
<code>{deviceId}</code>
</td>
</tr>
<tr>
<th scope="row">{_t("Session key:")}</th>
<td>
<code>
<b>{identityKey}</b>
</code>
</td>
</tr>
</table>
</SettingsSubsectionText>
{importExportButtons}
{noSendUnverifiedSetting}
</div>
</SettingsSubsection>
);
}

Expand Down
11 changes: 5 additions & 6 deletions src/components/views/settings/E2eAdvancedPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,20 @@ import { _t } from "../../../languageHandler";
import { SettingLevel } from "../../../settings/SettingLevel";
import SettingsStore from "../../../settings/SettingsStore";
import SettingsFlag from "../elements/SettingsFlag";
import SettingsSubsection, { SettingsSubsectionText } from "./shared/SettingsSubsection";

const SETTING_MANUALLY_VERIFY_ALL_SESSIONS = "e2ee.manuallyVerifyAllSessions";

const E2eAdvancedPanel: React.FC = () => {
return (
<div className="mx_SettingsTab_section">
<span className="mx_SettingsTab_subheading">{_t("Encryption")}</span>

<SettingsSubsection heading={_t("Encryption")}>
<SettingsFlag name={SETTING_MANUALLY_VERIFY_ALL_SESSIONS} level={SettingLevel.DEVICE} />
<div className="mx_SettingsTab_subsectionText">
<SettingsSubsectionText>
{_t(
"Individually verify each session used by a user to mark it as trusted, not trusting cross-signed devices.",
)}
</div>
</div>
</SettingsSubsectionText>
</SettingsSubsection>
);
};

Expand Down
Loading
Loading