Repository navigation
feat(mobile,trpc,auth,db): grace-period account deletion with reactivation #6395
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
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
16cd907
feat(mobile,trpc): add in-app account deletion
saddlepaddle cb948c9
feat(mobile,trpc,auth,db): grace-period account deletion with reactiv…
saddlepaddle 96c2611
feat(desktop,web,trpc): pending-deletion visibility, clients, and bil…
saddlepaddle 434ef87
feat(desktop,web): initiate account and org deletion from desktop and…
saddlepaddle 751c6ff
fix(desktop): state member blast radius in org deletion confirm
saddlepaddle 8e96c3b
fix(desktop): show deactivated members on the v2 org settings page
saddlepaddle 82fc4f9
refactor(db,auth,trpc,mobile,desktop,web): rename users.deletedAt to …
saddlepaddle File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
82 changes: 82 additions & 0 deletions
82
...renderer/routes/_authenticated/components/PendingDeletionScreen/PendingDeletionScreen.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,82 @@ | ||
| import { | ||
| ACCOUNT_DELETION_GRACE_DAYS, | ||
| COMPANY, | ||
| } from "@superset/shared/constants"; | ||
| import { Button } from "@superset/ui/button"; | ||
| import { useNavigate } from "@tanstack/react-router"; | ||
| import { useState } from "react"; | ||
| import { HiOutlineExclamationTriangle } from "react-icons/hi2"; | ||
| import { useSignOut } from "renderer/hooks/useSignOut"; | ||
| import { cloudTrpc } from "renderer/lib/cloud-trpc"; | ||
|
|
||
| const DAY_MS = 24 * 60 * 60 * 1000; | ||
|
|
||
| export function PendingDeletionScreen({ | ||
| deletionRequestedAt, | ||
| onReactivated, | ||
| }: { | ||
| deletionRequestedAt: Date; | ||
| onReactivated: () => void; | ||
| }) { | ||
| const navigate = useNavigate(); | ||
| const signOut = useSignOut(); | ||
| const [isSigningOut, setIsSigningOut] = useState(false); | ||
|
|
||
| const reactivate = cloudTrpc.user.reactivateAccount.useMutation({ | ||
| onSuccess: onReactivated, | ||
| }); | ||
|
|
||
| const purgeAt = | ||
| new Date(deletionRequestedAt).getTime() + | ||
| ACCOUNT_DELETION_GRACE_DAYS * DAY_MS; | ||
| const daysRemaining = Math.max(0, Math.ceil((purgeAt - Date.now()) / DAY_MS)); | ||
|
|
||
| return ( | ||
| <div className="relative flex h-screen w-screen flex-col items-center justify-center gap-4 bg-background"> | ||
| <div className="drag absolute inset-x-0 top-0 h-12" /> | ||
| <HiOutlineExclamationTriangle className="size-12 text-destructive" /> | ||
| <div className="text-center select-text cursor-text"> | ||
| <h2 className="text-lg font-medium">Account pending deletion</h2> | ||
| <p className="text-sm text-muted-foreground max-w-md"> | ||
| Your account is deactivated and will be permanently deleted | ||
| {daysRemaining > 0 | ||
| ? ` in ${daysRemaining} ${daysRemaining === 1 ? "day" : "days"}` | ||
| : " soon"} | ||
| . Reactivate to restore it exactly as you left it. | ||
| </p> | ||
| </div> | ||
| {reactivate.error && ( | ||
| <p className="text-sm text-destructive select-text cursor-text"> | ||
| {reactivate.error.message} | ||
| </p> | ||
| )} | ||
| <div className="flex gap-2"> | ||
| <Button | ||
| size="sm" | ||
| disabled={reactivate.isPending} | ||
| onClick={() => reactivate.mutate()} | ||
| > | ||
| {reactivate.isPending ? "Reactivating…" : "Reactivate my account"} | ||
| </Button> | ||
| <Button variant="outline" size="sm" asChild> | ||
| <a href={COMPANY.MAIL_TO}>Contact support</a> | ||
| </Button> | ||
| <Button | ||
| variant="outline" | ||
| size="sm" | ||
| disabled={isSigningOut} | ||
| onClick={async () => { | ||
| setIsSigningOut(true); | ||
| try { | ||
| await signOut(); | ||
| } finally { | ||
| void navigate({ to: "/sign-in", replace: true }); | ||
| } | ||
| }} | ||
| > | ||
| Sign out | ||
| </Button> | ||
| </div> | ||
| </div> | ||
| ); | ||
| } | ||
1 change: 1 addition & 0 deletions
1
apps/desktop/src/renderer/routes/_authenticated/components/PendingDeletionScreen/index.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| export { PendingDeletionScreen } from "./PendingDeletionScreen"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.