Skip to content

Conversation

uhoreg
Copy link
Member

@uhoreg uhoreg commented Aug 19, 2025

Fixes #29258

Probably easiest to review commit-by-commit

image

Checklist

  • Tests written for new code (and old code if feasible).
  • New or updated public/exported symbols have accurate TSDoc documentation.
  • Linter and other CI checks pass.
  • I have licensed the changes to Element by completing the Contributor License Agreement (CLA)

color: $authpage-primary-color;
background-color: $background;
border-radius: 4px;
padding: 20px;
padding: 20px 20px 60px 20px;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For some reason that I haven't been able to figure out, it squishes the bottom of the dialog, so I had to add some extra padding here.

@uhoreg uhoreg marked this pull request as ready for review August 20, 2025 15:49
@uhoreg uhoreg requested review from a team as code owners August 20, 2025 15:49
Copy link

dosubot bot commented Aug 20, 2025

Related Documentation

No published documentation to review for changes on this repository.
Write your first living document

How did I do? Any feedback?  Join Discord

Copy link
Member

@t3chguy t3chguy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks sane otherwise

});
};

private onLogOutClick = (): void => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for consistency, we seem to use logout as per https://dictionary.cambridge.org/dictionary/english/logout rather than log out so O should not be capitalised here

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure this is terribly important, but:

The handler should be named after the button that it handles. The button is labelled 'Sign out', so the handler should be onSignOutClick.

("Log out" is a verb; "logout" is a noun (the act of logging out). They are not interchangeable.)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had considered calling it onSignOutClick, but decided to use "log out" for consistency, since that term seemed to be used more in the code. But there are places in the code that use "sign out", so maybe I will change it. (Though I think that there is a case to be made about using the same terminology everywhere in the code for the same function, independent of what it says in the UI. For example, it makes it easier to find places that deal with logging out by grepping for a single string.)

If I do change the function to onSignOutClick, should I also change the property name to allowSignOut rather than allowLogout?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at this again, I think all the onFooClick methods (onUsePassphraseClick, onVerifiyClick, etc) should be renamed to match the name of the button that the user is actually clicking on, so yes it should be onSignOutClick.

In an ideal world the properties would also reflect the actual behaviour of the component but in that case I don't think it's so important and I wouldn't bother. The prop does need documentation though.

(In the case of the prop, the lower-case o in allowLogout or allowSignout rather than LogOut is fine: it is about whether to allow a logout to happen.)

@richvdh
Copy link
Member

richvdh commented Aug 22, 2025

I started reviewing this but I'm finding it really hard to follow. It's definitely too big to review in one lump, but the commits don't seem to make much sense either.

Could you try restructuring it, into smaller commits, with more explanation about what each commit is doing and why?

@@ -124,5 +128,7 @@ function titleForVariant(variant: ResetIdentityBodyVariant): string {
return _t("settings|encryption|advanced|breadcrumb_title_sync_failed");
case "forgot":
return _t("settings|encryption|advanced|breadcrumb_title_forgot");
case "cant_confirm":
return _t("settings|encryption|advanced|breadcrumb_tittle_cant_confirm");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We appear to be referencing a string here that is not defined.

Comment on lines 52 to 54
* "cant_confirm" is shown when the device is unverified and has no way of
* obtaining the existing keys, and hence the identity needs to be reset to have
* a cross-signed device.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be clearer if this was called "no_verification_method" or something, to distinguish from the case where the user clicks the "Can't confirm?" button in the "Confirm your identity" dialog.

});
};

private onLogOutClick = (): void => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at this again, I think all the onFooClick methods (onUsePassphraseClick, onVerifiyClick, etc) should be renamed to match the name of the button that the user is actually clicking on, so yes it should be onSignOutClick.

In an ideal world the properties would also reflect the actual behaviour of the component but in that case I don't think it's so important and I wouldn't bother. The prop does need documentation though.

(In the case of the prop, the lower-case o in allowLogout or allowSignout rather than LogOut is fine: it is about whether to allow a logout to happen.)

@@ -112,19 +116,23 @@ export default class SetupEncryptionBody extends React.Component<IProps, IState>
store.returnAfterSkip();
};

private onResetClick = (ev: ButtonEvent): void => {
ev.preventDefault();
private onResetClick = (): void => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

definitely think this should be called "onCantConfirmClick"

Comment on lines 9 to 11
.mx_EncryptionCard.mx_SetupEncryptionBody {
width: 600px;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why does this only apply when mx_SetupEncryptionBody is inside an EncryptionCard and not otherwise?

Also, can you help me understand why this is moving from mx_CompleteSecurityBody to here? What is the relationship between mx_CompleteSecurityBody and mx_EncryptionCard.mx_SetupEncryptionBody ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm. I'm not sure why I have the .mx_EncryptionCard in there. It looks like it isn't needed -- mx_SetupEncryptionBody isn't used anywhere else.

Also, can you help me understand why this is moving from mx_CompleteSecurityBody to here? What is the relationship between mx_CompleteSecurityBody and mx_EncryptionCard.mx_SetupEncryptionBody ?

mx_CompleteSecurityBody is only used when the user initially logs in. When SetupEncryptionBody is used as a modal inside the app, it's just inside of an .mx_Dialog (and associated things). So moving the style here means that it gets used both on initial login and within the app.

@uhoreg
Copy link
Member Author

uhoreg commented Aug 28, 2025

I've reworked the commits, to break it up into smaller chunks, and addressed the comments. Some of the style changes are still grouped together, but hopefully it's more understandable now.

@uhoreg uhoreg requested a review from richvdh August 28, 2025 00:53
Copy link
Member

@richvdh richvdh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

much easier to review now, thank you for rearranging it.

Generally lgtm, a few nits and questions

@@ -1064,7 +1066,7 @@
"unverified_sessions_toast_description": "Review to ensure your account is safe",
"unverified_sessions_toast_reject": "Later",
"unverified_sessions_toast_title": "You have unverified sessions",
"verification_description": "Verify your identity to access encrypted messages and prove your identity to others. If you also use a mobile device, please open the app there before you proceed.",
"verification_description": "Verify this device to set up secure messaging",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apparently we're not allowed to update existing strings outside of localazy (https://github.com/element-hq/element-web/blob/develop/docs/translating-dev.md#editing-existing-strings).

In order to keep the wording changes and the other design changes together, I suggest using a new translation key.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed it to use new translation keys.

@@ -967,7 +967,6 @@
"title": "Recovery Method Removed",
"warning": "If you didn't remove the recovery method, an attacker may be trying to access your account. Change your account password and set a new recovery method immediately in Settings."
},
"reset_all_button": "Forgotten or lost all recovery methods? <a>Reset all</a>",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note to future archaeologists: the reference to this string was removed in an earlier commit in this PR

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I tried to keep the string removals in the same commits as where the code stops using it, but I guess I missed this on.

"verify_using_device": "Verify with another device",
"verify_using_key": "Verify with Recovery Key",
"verify_using_device": "Use another device",
"verify_using_key": "Use recovery key",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these changes probably need to happen in localazy


export default class SetupEncryptionDialog extends React.Component<IProps> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you're basically rewriting a component, consider taking the opportunity to switch to the functional style. Not a blocker here though

@@ -29,4 +29,13 @@ Please see LICENSE files in the repository root for full details.
@media only screen and (max-width: 480px) {
margin-top: 0;
}

/* Extra class to indicate that the component is providing its own blurring,
* so we don't apply ours */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... nor a box-shadow, apparently.

What exactly does "blurring" mean, in this context?

This whole mechanism of overriding some of the inline styles by addition of another class feels a bit opaque. (Blurry, if you will.) It feels like maybe we should instead have a class which enables the blurring, and which AuthPage enables by default, but which you can disable via a boolean property on AuthPage (instead of the modalClasses prop). WDYT?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This whole mechanism of overriding some of the inline styles by addition of another class feels a bit opaque. (Blurry, if you will.) It feels like maybe we should instead have a class which enables the blurring, and which AuthPage enables by default, but which you can disable via a boolean property on AuthPage (instead of the modalClasses prop). WDYT?

Done. I had originally used the class property to make it more flexible, but the boolean is clearer what the intent is.

await page.getByRole("button", { name: "Proceed with reset" }).click();
await page.getByRole("button", { name: "Can't confirm?" }).click();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just for future reference: it's much nicer to review changes where the author has at least aimed for the tests to pass after each commit (so the tests and app are updated in sync)

Co-authored-by: Richard van der Hoff <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

EW: "Verify this device" modal needs design update
3 participants