Repository navigation
feat(profile): self-service account deletion - #1253
JamieRuderman wants to merge 12 commits into
Conversation
…nstall and org copy
|
@codex review |
|
This pull request is automatically being deployed by Amplify Hosting (learn more). |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f69d909b71
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| return () => { | ||
| current = false | ||
| } | ||
| }, [enabled, userId]) |
There was a problem hiding this comment.
Refetch ownership when the local device ID changes
When this hook fetches while backend.thisId is still empty—for example, before the desktop backend reports its registration—or when this device is registered after the first fetch, the cached result has thisDeviceOwned: false. Because the effect omits thisId from its dependencies and also stops once owned is set, the ownership state is never refreshed; DeleteAccountDialog consequently skips unregisterThisDevice() and deletes the account without first unregistering the local agent. Invalidate and refetch the cached ownership whenever thisId changes.
Useful? React with 👍 / 👎.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4861aef81b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
|
||
| useEffect(() => { | ||
| if (!enabled || !userId) return | ||
| if (owned && (!thisId || thisId === fetchedFor.current)) return |
There was a problem hiding this comment.
Refresh ownership whenever a dialog is reopened
After either dialog has loaded once, closing and reopening it leaves owned populated, so this guard prevents a new request even though enabled toggled off and back on. If the local device is transferred to or from this account while the Profile page remains mounted, its ID stays the same but thisDeviceOwned changes; the deletion flow then either skips the required unregister or attempts to unregister a device the user no longer owns. Invalidate the cached result when the dialog closes or fetch again on each open.
Useful? React with 👍 / 👎.
|
@codex review |
|
Codex Review: Didn't find any major issues. You're on a roll. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
Amplify branch preview (ready once the build finishes): https://feat-self-service-account-deletion.d20k671nqqv4kl.amplifyapp.com |
Summary
Replaces the "request account deletion" email form on the Profile page with real self-service deletion, using the graphql-api
requestAccountDeletion/deleteAccount(code)mutations.How to remove Remote.It is the main action. It opens instructions for uninstalling from each kind of device (Debian/Raspberry Pi and OpenWrt commands, the desktop apps, and a link to the support article), plus a list of the devices the person owns.
Delete my account is the secondary action. It opens a three-step dialog:
When the computer running the desktop app is registered to the person, that device is unregistered first (
registration: DELETEthrough the local backend). If that fails, the account is not deleted. After deletion the dialog shows a confirmation and signs out.The paid-plan and organization-member notices are now advisory and link to the place to fix them. The server makes the final decision, so a client check that's stricter than the server can no longer block someone permanently.
Copy is in en/ja/de/es. The obsolete
ui.deleteAccountflag and the old "3–5 business days" strings are removed, andcommon.continuenow has ja/de/es translations, which were missing.Notes
deleteAccount(code)runs, because the CLI needs the person's credentials to unregister. A mistyped code or a refusal at confirmation therefore leaves this device unregistered while the account remains. A verify-without-consuming step in graphql-api would close that gap.Test plan
npx tsc --noEmitnpx vitest run(157 tests). New tests cover the dialog flow (acknowledgement gate, unregister-before-delete, failed unregister aborts the deletion, wrong-code limit, refusals, network failure keeps the code, the survey is optional),backend.unregisterThisDevice, and owned-device parsing.npm run i18n:check