Skip to content

Update identity reset UI (Make consistent with EX) #29701

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

Open
wants to merge 9 commits into
base: develop
Choose a base branch
from

Conversation

andybalaam
Copy link
Member

@andybalaam andybalaam commented Apr 9, 2025

Fixes #29227

This adds IdentityResetDialog, which wraps IdentityResetBody in a dialog, and launches it from SetupEncryptionBody, instead of doing the reset directly there.

image

This is mostly work by @uhoreg , rebased and refactored a bit here.

I recommend reviewing commit-by-commit.

@andybalaam andybalaam added T-Defect T-Feature Request to add a new feature which does not exist right now and removed T-Defect labels Apr 9, 2025
@andybalaam andybalaam added T-Enhancement and removed T-Feature Request to add a new feature which does not exist right now labels Apr 9, 2025
@andybalaam andybalaam force-pushed the andybalaam/reset-encryption-redesign2 branch from 5ca414f to fec5e88 Compare April 11, 2025 10:56
@andybalaam andybalaam force-pushed the andybalaam/reset-encryption-redesign2 branch 2 times, most recently from 0edccfe to dab78ad Compare April 11, 2025 15:02
@andybalaam andybalaam force-pushed the andybalaam/reset-encryption-redesign2 branch from dab78ad to 8f0073e Compare April 11, 2025 15:12
@andybalaam andybalaam force-pushed the andybalaam/reset-encryption-redesign2 branch from 8f0073e to f3035e1 Compare April 14, 2025 09:28
@andybalaam andybalaam force-pushed the andybalaam/reset-encryption-redesign2 branch from f3035e1 to 94c7056 Compare April 14, 2025 14:16
@andybalaam andybalaam force-pushed the andybalaam/reset-encryption-redesign2 branch from 94c7056 to 4fdc53e Compare April 14, 2025 14:21
@andybalaam andybalaam force-pushed the andybalaam/reset-encryption-redesign2 branch from 4fdc53e to fff5732 Compare April 14, 2025 16:02
@andybalaam andybalaam force-pushed the andybalaam/reset-encryption-redesign2 branch from fff5732 to eccb05c Compare April 15, 2025 07:31
@andybalaam andybalaam requested a review from richvdh April 15, 2025 11:27
/**
* Called when the identity is reset (before onFinished is called).
*/
onReset: MouseEventHandler<HTMLButtonElement>;
Copy link
Member

Choose a reason for hiding this comment

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

It seems a bit weird for 'onReset' to take a mouse event: it's hard to see how the original click would be relevant.

Copy link
Member

Choose a reason for hiding this comment

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

It's just copied from the original settings panel (where I don't think the mouse event is used either). We can get rid of it here.

Copy link
Member

Choose a reason for hiding this comment

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

I've changed this to be a function with no arguments. Should I also change ResetIdentityBody and ResetIdentityPanel (since we already touch those lines in this PR)?

Copy link
Member

Choose a reason for hiding this comment

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

Oh I see - thanks. Up to you whether you fancy changing it elsewhere.

},
onFinished: () => {
// The user cancelled the reset dialog or click away - go back a step
this.onResetBackClick();
Copy link
Member

Choose a reason for hiding this comment

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

onFinished is called in either case isn't it? Is there a risk this will confuse things by clicking back after the dialog is done (also I don't love that we are calling click handlers for reasons other than when a click happened).

Copy link
Member

Choose a reason for hiding this comment

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

I've added an onCancelled callback, and used that. I'm not sure if it's necessary, but it's clearer

Copy link
Member

Choose a reason for hiding this comment

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

Also changed the code so that it doesn't call the click handlers.

Copy link
Member

Choose a reason for hiding this comment

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

Thanks!

onReset: () => {
// The user completed the reset process - close this dialog
this.props.onFinished();
this.onDoneClick();
Copy link
Member

Choose a reason for hiding this comment

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

As per below on calling click handlers rather than them just handling clicks.

Comment on lines 45 to 55
// Wrappers for ResetIdentityBody's callbacks so that onFinish gets called
// whenever the reset is done, whether by completing successfully, or by
// being cancelled
const onResetWrapper: MouseEventHandler<HTMLButtonElement> = (...args) => {
onFinished();
onResetFinished(...args);
};
const onCancelWrapper: () => void = () => {
onFinished();
onCancelClick();
};
Copy link
Member

Choose a reason for hiding this comment

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

General feedback: this seems to immediately change in the next commit, so reviewing it is trickier than it needs to be

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.

Struggling to follow this :/

* "forgot" is shown when the user has just forgotten their passphrase.
* "forgot" is shown when the user chose 'Forgot recovery key?' during `SetupEncryptionToast`.
*
* "confirm" is shown when the user chose 'Reset all' during `SetupEncryptionBody`.
Copy link
Member

Choose a reason for hiding this comment

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

it would be good to detail how the behaviour is different, rather than when it is called.

Copy link
Member

Choose a reason for hiding this comment

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

No behaviour change. It just changes the messages displayed. I've added a comment about that.

Comment on lines -249 to +256
} else if (phase === Phase.ConfirmReset) {
return (
<div>
<p>{_t("encryption|verification|verify_reset_warning_1")}</p>
<p>{_t("encryption|verification|verify_reset_warning_2")}</p>

<div className="mx_CompleteSecurity_actionRow">
<AccessibleButton kind="danger_outline" onClick={this.onResetConfirmClick}>
{_t("encryption|verification|reset_proceed_prompt")}
</AccessibleButton>
<AccessibleButton kind="primary" onClick={this.onResetBackClick}>
{_t("action|go_back")}
</AccessibleButton>
</div>
</div>
);
} else if (phase === Phase.Busy || phase === Phase.Loading) {
} else if (phase === Phase.Busy || phase === Phase.Loading || phase == Phase.ConfirmReset) {
Copy link
Member

Choose a reason for hiding this comment

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

again, bit confused about why it is safe to get rid of the confirm step, and why we now show a spinner for "ConfirmReset".

Copy link
Member

Choose a reason for hiding this comment

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

This dialog used to do confirm resetting the identity, but now it uses ResetIdentityDialog to do so. So during the "ConfirmReset" stage, this dialog just shows a spinner, while ResetIdentityDialog does the actual confirmation.

@farouk2025

This comment was marked as spam.

@farouk2025

This comment was marked as spam.

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.

Slightly struggling to understand the scope of the changes here.

Make identity reset consistent with EX

Before I try and page in the code changes again, could we rephrase this in a way that summarises what's actually changing in EW as part of this change? A few screenshots might not go amiss, either.

Fixes #29227

The linked issue isn't terribly helpful at getting an overview of what actually needs to change: it links to a load of designs but I'm unclear what is already done and what this PR is aiming to change. But in particular: #29227 talks about changing something in the OIDC flow, which doesn't seem to be done here? Is that because it's already done?

I recommend reviewing commit-by-commit.

I assume this is no longer the recommended approach?

@uhoreg uhoreg changed the title Make identity reset consistent with EX Update identity reset UI (Make consistent with EX) Apr 24, 2025
@uhoreg
Copy link
Member

uhoreg commented Apr 24, 2025

Slightly struggling to understand the scope of the changes here.

Make identity reset consistent with EX

Before I try and page in the code changes again, could we rephrase this in a way that summarises what's actually changing in EW as part of this change? A few screenshots might not go amiss, either.

Added a screenshot, and updated the title. It is "just" a UI update, with the annoying part being that in order to get the desired UI, I had to make it pop up a new modal, rather than to do it all in SetupEncryptionBody.

Fixes #29227

The linked issue isn't terribly helpful at getting an overview of what actually needs to change: it links to a load of designs but I'm unclear what is already done and what this PR is aiming to change. But in particular: #29227 talks about changing something in the OIDC flow, which doesn't seem to be done here? Is that because it's already done?

Looks like Andy and I both missed the OIDC part. But I've split it off into #29809 since it's a separate component and is non-trivial.

I recommend reviewing commit-by-commit.

I assume this is no longer the recommended approach?

Yes, by now it has accumulated enough commits that that approach may not be the best.

@uhoreg uhoreg requested a review from richvdh April 24, 2025 20:12
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: Make identity reset consistent with EX
5 participants