mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-23 09:17:06 +08:00
feat(core): show server name when delete account (#13175)
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Account deletion prompts and confirmation dialogs now display the specific server name, providing clearer context when deleting your account. * **Localization** * Updated account deletion messages to explicitly mention the server name. * Improved translation keys to support server-specific messaging in all supported languages. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -3,7 +3,7 @@ import {
|
||||
SettingRow,
|
||||
SettingWrapper,
|
||||
} from '@affine/component/setting-components';
|
||||
import { AuthService } from '@affine/core/modules/cloud';
|
||||
import { AuthService, ServerService } from '@affine/core/modules/cloud';
|
||||
import { WorkspacesService } from '@affine/core/modules/workspace';
|
||||
import { UserFriendlyError } from '@affine/error';
|
||||
import { Trans, useI18n } from '@affine/i18n';
|
||||
@@ -18,6 +18,7 @@ import * as styles from './style.css';
|
||||
export const DeleteAccount = () => {
|
||||
const t = useI18n();
|
||||
|
||||
const serverService = useService(ServerService);
|
||||
const workspacesService = useService(WorkspacesService);
|
||||
const workspaceProfiles = workspacesService.getAllWorkspaceProfile();
|
||||
const isTeamWorkspaceOwner = workspaceProfiles.some(
|
||||
@@ -33,7 +34,9 @@ export const DeleteAccount = () => {
|
||||
<SettingRow
|
||||
name={
|
||||
<span style={{ color: cssVarV2('status/error') }}>
|
||||
{t['com.affine.setting.account.delete']()}
|
||||
{t['com.affine.setting.account.delete-from-server']({
|
||||
server: serverService.server.config$.value.serverName,
|
||||
})}
|
||||
</span>
|
||||
}
|
||||
desc={t['com.affine.setting.account.delete.message']()}
|
||||
@@ -96,6 +99,7 @@ const DeleteAccountModal = ({
|
||||
const authService = useService(AuthService);
|
||||
const session = authService.session;
|
||||
const account = useLiveData(session.account$);
|
||||
const serverService = useService(ServerService);
|
||||
|
||||
const [email, setEmail] = useState('');
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
@@ -128,9 +132,22 @@ const DeleteAccountModal = ({
|
||||
onConfirm={onDeleteAccountConfirm}
|
||||
onOpenChange={onOpenChange}
|
||||
title={t['com.affine.setting.account.delete.confirm-title']()}
|
||||
description={t[
|
||||
'com.affine.setting.account.delete.confirm-description-1'
|
||||
]()}
|
||||
description={
|
||||
<Trans
|
||||
i18nKey={
|
||||
'com.affine.setting.account.delete.confirm-delete-description-1'
|
||||
}
|
||||
components={{
|
||||
1: <strong />,
|
||||
}}
|
||||
values={{
|
||||
server:
|
||||
serverService.server.id !== 'affine-cloud'
|
||||
? `${serverService.server.config$.value.serverName} (${serverService.server.baseUrl})`
|
||||
: serverService.server.config$.value.serverName,
|
||||
}}
|
||||
/>
|
||||
}
|
||||
confirmText={t['com.affine.setting.account.delete.confirm-button']()}
|
||||
confirmButtonOptions={{
|
||||
variant: 'error',
|
||||
@@ -140,7 +157,7 @@ const DeleteAccountModal = ({
|
||||
childrenContentClassName={styles.confirmContent}
|
||||
>
|
||||
<Trans
|
||||
i18nKey="com.affine.setting.account.delete.confirm-description-2"
|
||||
i18nKey="com.affine.setting.account.delete.confirm-delete-description-2"
|
||||
components={{
|
||||
1: <strong />,
|
||||
}}
|
||||
|
||||
@@ -4838,9 +4838,11 @@ export function useAFFiNEI18N(): {
|
||||
*/
|
||||
["com.affine.setting.account"](): string;
|
||||
/**
|
||||
* `Delete your account`
|
||||
* `Delete your account from {{server}}`
|
||||
*/
|
||||
["com.affine.setting.account.delete"](): string;
|
||||
["com.affine.setting.account.delete-from-server"](options: {
|
||||
readonly server: string;
|
||||
}): string;
|
||||
/**
|
||||
* `Once deleted, your account will no longer be accessible, and all data in your personal cloud space will be permanently deleted.`
|
||||
*/
|
||||
@@ -4857,10 +4859,6 @@ export function useAFFiNEI18N(): {
|
||||
* `Delete your account?`
|
||||
*/
|
||||
["com.affine.setting.account.delete.confirm-title"](): string;
|
||||
/**
|
||||
* `Are you sure you want to delete your account?`
|
||||
*/
|
||||
["com.affine.setting.account.delete.confirm-description-1"](): string;
|
||||
/**
|
||||
* `Please type your email to confirm`
|
||||
*/
|
||||
@@ -9291,10 +9289,18 @@ export const TypedTrans: {
|
||||
}, {
|
||||
["1"]: JSX.Element;
|
||||
}>>;
|
||||
/**
|
||||
* `Are you sure you want to delete your account from <1>{{server}}</1>?`
|
||||
*/
|
||||
["com.affine.setting.account.delete.confirm-delete-description-1"]: ComponentType<TypedTransProps<{
|
||||
readonly server: string;
|
||||
}, {
|
||||
["1"]: JSX.Element;
|
||||
}>>;
|
||||
/**
|
||||
* `Your account will be inaccessible, and your personal cloud space will be permanently deleted. You can remove local data by uninstalling the app or clearing your browser storage. <1>This action is irreversible.</1>`
|
||||
*/
|
||||
["com.affine.setting.account.delete.confirm-description-2"]: ComponentType<TypedTransProps<Readonly<{}>, {
|
||||
["com.affine.setting.account.delete.confirm-delete-description-2"]: ComponentType<TypedTransProps<Readonly<{}>, {
|
||||
["1"]: JSX.Element;
|
||||
}>>;
|
||||
/**
|
||||
|
||||
@@ -1202,13 +1202,13 @@
|
||||
"com.affine.setting.notifications.email.comments.title": "Comments",
|
||||
"com.affine.setting.notifications.email.comments.subtitle": "You will be notified through email when other members of the workspace comment on your docs.",
|
||||
"com.affine.setting.account": "Account settings",
|
||||
"com.affine.setting.account.delete": "Delete your account",
|
||||
"com.affine.setting.account.delete-from-server": "Delete your account from {{server}}",
|
||||
"com.affine.setting.account.delete.message": "Once deleted, your account will no longer be accessible, and all data in your personal cloud space will be permanently deleted.",
|
||||
"com.affine.setting.account.delete.team-warning-title": "Cannot delete account",
|
||||
"com.affine.setting.account.delete.team-warning-description": "You’re the owner of a team workspace. To delete your account, please delete the workspace or transfer ownership first.",
|
||||
"com.affine.setting.account.delete.confirm-title": "Delete your account?",
|
||||
"com.affine.setting.account.delete.confirm-description-1": "Are you sure you want to delete your account?",
|
||||
"com.affine.setting.account.delete.confirm-description-2": "Your account will be inaccessible, and your personal cloud space will be permanently deleted. You can remove local data by uninstalling the app or clearing your browser storage. <1>This action is irreversible.</1>",
|
||||
"com.affine.setting.account.delete.confirm-delete-description-1": "Are you sure you want to delete your account from <1>{{server}}</1>?",
|
||||
"com.affine.setting.account.delete.confirm-delete-description-2": "Your account will be inaccessible, and your personal cloud space will be permanently deleted. You can remove local data by uninstalling the app or clearing your browser storage. <1>This action is irreversible.</1>",
|
||||
"com.affine.setting.account.delete.input-placeholder": "Please type your email to confirm",
|
||||
"com.affine.setting.account.delete.confirm-button": "Delete",
|
||||
"com.affine.setting.account.delete.success-title": "Account deleted",
|
||||
|
||||
Reference in New Issue
Block a user