Skip to content

Commit

Permalink
Unify and slightly reword account deletion (#3742)
Browse files Browse the repository at this point in the history
  • Loading branch information
Swatinem authored Feb 20, 2025
1 parent f812bcb commit c1f92fd
Show file tree
Hide file tree
Showing 10 changed files with 40 additions and 104 deletions.
3 changes: 2 additions & 1 deletion src/pages/AccountSettings/tabs/Admin/Admin.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ import { useParams } from 'react-router-dom'

import { useUser } from 'services/user'

import DeletionCard from './DeletionCard'
import DetailsSection from './DetailsSection'
import GithubIntegrationSection from './GithubIntegrationSection'
import ManageAdminCard from './ManageAdminCard'
import StudentSection from './StudentSection'

import DeletionCard from '../DeletionCard'

function Admin() {
const { owner } = useParams()
const { data: currentUser } = useUser()
Expand Down
2 changes: 1 addition & 1 deletion src/pages/AccountSettings/tabs/Admin/Admin.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ vi.mock('./GithubIntegrationSection', () => ({
default: () => 'GithubIntegrationSection',
}))
vi.mock('./ManageAdminCard', () => ({ default: () => 'ManageAdminCard' }))
vi.mock('./DeletionCard', () => ({ default: () => 'DeletionCard' }))
vi.mock('../DeletionCard', () => ({ default: () => 'DeletionCard' }))

const user = {
me: {
Expand Down
45 changes: 0 additions & 45 deletions src/pages/AccountSettings/tabs/Admin/DeletionCard/DeletionCard.tsx

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ describe('DeletionCard', () => {
render(<DeletionCard isPersonalSettings={true} />, { wrapper })

const message = screen.getByText(
/Erase all my personal content and projects./
/Erase my personal account and all my repositories./
)
expect(message).toBeInTheDocument()
})
Expand All @@ -33,7 +33,7 @@ describe('DeletionCard', () => {
render(<DeletionCard isPersonalSettings={false} />, { wrapper })

const message = screen.getByText(
/Erase all my organization content and projects./
/Erase organization and all its repositories./
)
expect(message).toBeInTheDocument()
})
Expand Down
32 changes: 32 additions & 0 deletions src/pages/AccountSettings/tabs/DeletionCard/DeletionCard.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import Card from 'old_ui/Card'
import A from 'ui/A'

interface DeletionCardProps {
isPersonalSettings: boolean
}

function DeletionCard({ isPersonalSettings }: DeletionCardProps) {
return (
<div className="flex flex-col gap-4">
<h2 className="text-lg font-semibold">
{isPersonalSettings ? 'Delete account' : 'Delete organization'}
</h2>
<Card>
<p>
{isPersonalSettings
? 'Erase my personal account and all my repositories. '
: 'Erase organization and all its repositories. '}
<A
to={{ pageName: 'support' }}
hook="contact-support-link"
isExternal
>
Contact support
</A>
</p>
</Card>
</div>
)
}

export default DeletionCard

This file was deleted.

This file was deleted.

This file was deleted.

5 changes: 3 additions & 2 deletions src/pages/AccountSettings/tabs/Profile/Profile.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ import { SelfHostedCurrentUserQueryOpts } from 'services/selfHosted/SelfHostedCu

import ActivationBanner from './ActivationBanner'
import AdminBanner from './AdminBanner'
import DeletionCard from './DeletionCard'
import NameEmailCard from './NameEmailCard'

import DeletionCard from '../DeletionCard'

function Profile({ provider, owner }) {
const yamlTab = `/account/${provider}/${owner}/yaml/`
const { data: currentUser } = useSuspenseQueryV5(
Expand All @@ -27,7 +28,7 @@ function Profile({ provider, owner }) {
{currentUser?.isAdmin && <AdminBanner />}
<ActivationBanner />
<NameEmailCard currentUser={currentUser} provider={provider} />
<DeletionCard />
<DeletionCard isPersonalSettings={isPersonalSettings} />
</div>
)
}
Expand Down

0 comments on commit c1f92fd

Please sign in to comment.