From 02f567f2c0bb9c1211dee3aef0440ad58e3f964d Mon Sep 17 00:00:00 2001 From: forehalo Date: Wed, 19 Feb 2025 10:38:38 +0000 Subject: [PATCH] chore(core): better doc action error message (#10288) --- .../backend/server/src/__tests__/team.e2e.ts | 6 ++-- .../server/src/__tests__/workspace.e2e.ts | 4 +-- packages/backend/server/src/base/error/def.ts | 8 ++--- .../server/src/base/error/errors.gen.ts | 13 ++++---- .../server/src/core/permission/service.ts | 4 +-- .../src/core/workspaces/resolvers/doc.ts | 4 +-- packages/backend/server/src/schema.gql | 7 ++-- .../src/main/graphql/affine/schema.graphqls | 2 +- .../general-access/public-page-button.tsx | 16 +++------- packages/frontend/graphql/src/schema.ts | 24 +++++++++++--- .../i18n/src/i18n-completenesses.json | 32 +++++++++---------- packages/frontend/i18n/src/i18n.gen.ts | 22 ++++--------- packages/frontend/i18n/src/resources/en.json | 4 +-- 13 files changed, 74 insertions(+), 72 deletions(-) diff --git a/packages/backend/server/src/__tests__/team.e2e.ts b/packages/backend/server/src/__tests__/team.e2e.ts index fc7dcd2c15..b968dc7aff 100644 --- a/packages/backend/server/src/__tests__/team.e2e.ts +++ b/packages/backend/server/src/__tests__/team.e2e.ts @@ -856,7 +856,7 @@ test('default page role should be able to override the workspace role', async t await t.throwsAsync( updateDocDefaultRole(app, workspace.id, docId, DocRole.Manager), { - message: `You do not have permission to access doc ${docId} under Space ${workspace.id}.`, + message: `You do not have permission to perform Doc.Users.Manage action on doc ${docId}.`, } ); } @@ -908,7 +908,7 @@ test('should be able to grant and revoke doc user role', async t => { // external user can't manage the page app.switchUser(external); await t.throwsAsync(revokeDocUserRoles(app, ws.id, docId, read.id), { - message: `You do not have permission to access doc ${docId} under Space ${ws.id}.`, + message: `You do not have permission to perform Doc.Users.Manage action on doc ${docId}.`, }); } }); @@ -922,7 +922,7 @@ test('update page default role should throw error if the space does not exist', await t.throwsAsync( updateDocDefaultRole(app, nonExistWorkspaceId, docId, DocRole.Manager), { - message: `You do not have permission to access doc ${docId} under Space ${nonExistWorkspaceId}.`, + message: `You do not have permission to perform Doc.Users.Manage action on doc ${docId}.`, } ); }); diff --git a/packages/backend/server/src/__tests__/workspace.e2e.ts b/packages/backend/server/src/__tests__/workspace.e2e.ts index ce178b2865..5489b6d230 100644 --- a/packages/backend/server/src/__tests__/workspace.e2e.ts +++ b/packages/backend/server/src/__tests__/workspace.e2e.ts @@ -108,12 +108,12 @@ test('should not be able to public not permitted doc', async t => { await t.throwsAsync(publishDoc(app, 'not_exists_ws', 'doc2'), { message: - 'You do not have permission to access doc doc2 under Space not_exists_ws.', + 'You do not have permission to perform Doc.Publish action on doc doc2.', }); await t.throwsAsync(revokePublicDoc(app, 'not_exists_ws', 'doc2'), { message: - 'You do not have permission to access doc doc2 under Space not_exists_ws.', + 'You do not have permission to perform Doc.Publish action on doc doc2.', }); }); diff --git a/packages/backend/server/src/base/error/def.ts b/packages/backend/server/src/base/error/def.ts index 85e6b8f09b..a7eb92b2b2 100644 --- a/packages/backend/server/src/base/error/def.ts +++ b/packages/backend/server/src/base/error/def.ts @@ -419,11 +419,11 @@ export const USER_FRIENDLY_ERRORS = { message: ({ spaceId, docId }) => `Doc ${docId} under Space ${spaceId} not found.`, }, - doc_access_denied: { + doc_action_denied: { type: 'no_permission', - args: { spaceId: 'string', docId: 'string' }, - message: ({ spaceId, docId }) => - `You do not have permission to access doc ${docId} under Space ${spaceId}.`, + args: { spaceId: 'string', docId: 'string', action: 'string' }, + message: ({ docId, action }) => + `You do not have permission to perform ${action} action on doc ${docId}.`, }, version_rejected: { type: 'action_forbidden', diff --git a/packages/backend/server/src/base/error/errors.gen.ts b/packages/backend/server/src/base/error/errors.gen.ts index 49d70022f8..25ac6f26b2 100644 --- a/packages/backend/server/src/base/error/errors.gen.ts +++ b/packages/backend/server/src/base/error/errors.gen.ts @@ -299,14 +299,15 @@ export class DocNotFound extends UserFriendlyError { } } @ObjectType() -class DocAccessDeniedDataType { +class DocActionDeniedDataType { @Field() spaceId!: string @Field() docId!: string + @Field() action!: string } -export class DocAccessDenied extends UserFriendlyError { - constructor(args: DocAccessDeniedDataType, message?: string | ((args: DocAccessDeniedDataType) => string)) { - super('no_permission', 'doc_access_denied', message, args); +export class DocActionDenied extends UserFriendlyError { + constructor(args: DocActionDeniedDataType, message?: string | ((args: DocActionDeniedDataType) => string)) { + super('no_permission', 'doc_action_denied', message, args); } } @ObjectType() @@ -832,7 +833,7 @@ export enum ErrorNames { SPACE_OWNER_NOT_FOUND, SPACE_SHOULD_HAVE_ONLY_ONE_OWNER, DOC_NOT_FOUND, - DOC_ACCESS_DENIED, + DOC_ACTION_DENIED, VERSION_REJECTED, INVALID_HISTORY_TIMESTAMP, DOC_HISTORY_NOT_FOUND, @@ -903,5 +904,5 @@ registerEnumType(ErrorNames, { export const ErrorDataUnionType = createUnionType({ name: 'ErrorDataUnion', types: () => - [GraphqlBadRequestDataType, QueryTooLongDataType, WrongSignInCredentialsDataType, UnknownOauthProviderDataType, MissingOauthQueryParameterDataType, InvalidEmailDataType, InvalidPasswordLengthDataType, WorkspacePermissionNotFoundDataType, SpaceNotFoundDataType, MemberNotFoundInSpaceDataType, NotInSpaceDataType, AlreadyInSpaceDataType, SpaceAccessDeniedDataType, SpaceOwnerNotFoundDataType, SpaceShouldHaveOnlyOneOwnerDataType, DocNotFoundDataType, DocAccessDeniedDataType, VersionRejectedDataType, InvalidHistoryTimestampDataType, DocHistoryNotFoundDataType, BlobNotFoundDataType, ExpectToGrantDocUserRolesDataType, ExpectToRevokeDocUserRolesDataType, ExpectToUpdateDocUserRoleDataType, UnsupportedSubscriptionPlanDataType, SubscriptionAlreadyExistsDataType, SubscriptionNotExistsDataType, SameSubscriptionRecurringDataType, SubscriptionPlanNotFoundDataType, CopilotDocNotFoundDataType, CopilotMessageNotFoundDataType, CopilotPromptNotFoundDataType, CopilotProviderSideErrorDataType, CopilotInvalidContextDataType, CopilotContextFileNotSupportedDataType, CopilotFailedToModifyContextDataType, CopilotFailedToMatchContextDataType, RuntimeConfigNotFoundDataType, InvalidRuntimeConfigTypeDataType, InvalidLicenseUpdateParamsDataType, WorkspaceMembersExceedLimitToDowngradeDataType] as const, + [GraphqlBadRequestDataType, QueryTooLongDataType, WrongSignInCredentialsDataType, UnknownOauthProviderDataType, MissingOauthQueryParameterDataType, InvalidEmailDataType, InvalidPasswordLengthDataType, WorkspacePermissionNotFoundDataType, SpaceNotFoundDataType, MemberNotFoundInSpaceDataType, NotInSpaceDataType, AlreadyInSpaceDataType, SpaceAccessDeniedDataType, SpaceOwnerNotFoundDataType, SpaceShouldHaveOnlyOneOwnerDataType, DocNotFoundDataType, DocActionDeniedDataType, VersionRejectedDataType, InvalidHistoryTimestampDataType, DocHistoryNotFoundDataType, BlobNotFoundDataType, ExpectToGrantDocUserRolesDataType, ExpectToRevokeDocUserRolesDataType, ExpectToUpdateDocUserRoleDataType, UnsupportedSubscriptionPlanDataType, SubscriptionAlreadyExistsDataType, SubscriptionNotExistsDataType, SameSubscriptionRecurringDataType, SubscriptionPlanNotFoundDataType, CopilotDocNotFoundDataType, CopilotMessageNotFoundDataType, CopilotPromptNotFoundDataType, CopilotProviderSideErrorDataType, CopilotInvalidContextDataType, CopilotContextFileNotSupportedDataType, CopilotFailedToModifyContextDataType, CopilotFailedToMatchContextDataType, RuntimeConfigNotFoundDataType, InvalidRuntimeConfigTypeDataType, InvalidLicenseUpdateParamsDataType, WorkspaceMembersExceedLimitToDowngradeDataType] as const, }); diff --git a/packages/backend/server/src/core/permission/service.ts b/packages/backend/server/src/core/permission/service.ts index 7a0a4e9cd5..05fffbd04c 100644 --- a/packages/backend/server/src/core/permission/service.ts +++ b/packages/backend/server/src/core/permission/service.ts @@ -5,7 +5,7 @@ import { groupBy } from 'lodash-es'; import { CanNotBatchGrantDocOwnerPermissions, - DocAccessDenied, + DocActionDenied, EventBus, OnEvent, SpaceAccessDenied, @@ -552,7 +552,7 @@ export class PermissionService { user?: string ) { if (!(await this.tryCheckPage(ws, page, action, user))) { - throw new DocAccessDenied({ spaceId: ws, docId: page }); + throw new DocActionDenied({ spaceId: ws, docId: page, action }); } } diff --git a/packages/backend/server/src/core/workspaces/resolvers/doc.ts b/packages/backend/server/src/core/workspaces/resolvers/doc.ts index 93ecc1c754..289b02fa56 100644 --- a/packages/backend/server/src/core/workspaces/resolvers/doc.ts +++ b/packages/backend/server/src/core/workspaces/resolvers/doc.ts @@ -14,7 +14,7 @@ import type { WorkspaceDoc as PrismaWorkspaceDoc } from '@prisma/client'; import { PrismaClient } from '@prisma/client'; import { - DocAccessDenied, + DocActionDenied, DocDefaultRoleCanNotBeOwner, DocIsNotPublic, ExpectToGrantDocUserRoles, @@ -662,7 +662,7 @@ export class DocResolver { user.id ); } catch (error) { - if (error instanceof DocAccessDenied) { + if (error instanceof DocActionDenied) { this.logger.log( `User does not have permission to update page default role (${JSON.stringify( { diff --git a/packages/backend/server/src/schema.gql b/packages/backend/server/src/schema.gql index f04f00de8b..4fb89a016a 100644 --- a/packages/backend/server/src/schema.gql +++ b/packages/backend/server/src/schema.gql @@ -250,7 +250,8 @@ input DeleteSessionInput { workspaceId: String! } -type DocAccessDeniedDataType { +type DocActionDeniedDataType { + action: String! docId: String! spaceId: String! } @@ -315,7 +316,7 @@ type EditorType { name: String! } -union ErrorDataUnion = AlreadyInSpaceDataType | BlobNotFoundDataType | CopilotContextFileNotSupportedDataType | CopilotDocNotFoundDataType | CopilotFailedToMatchContextDataType | CopilotFailedToModifyContextDataType | CopilotInvalidContextDataType | CopilotMessageNotFoundDataType | CopilotPromptNotFoundDataType | CopilotProviderSideErrorDataType | DocAccessDeniedDataType | DocHistoryNotFoundDataType | DocNotFoundDataType | ExpectToGrantDocUserRolesDataType | ExpectToRevokeDocUserRolesDataType | ExpectToUpdateDocUserRoleDataType | GraphqlBadRequestDataType | InvalidEmailDataType | InvalidHistoryTimestampDataType | InvalidLicenseUpdateParamsDataType | InvalidPasswordLengthDataType | InvalidRuntimeConfigTypeDataType | MemberNotFoundInSpaceDataType | MissingOauthQueryParameterDataType | NotInSpaceDataType | QueryTooLongDataType | RuntimeConfigNotFoundDataType | SameSubscriptionRecurringDataType | SpaceAccessDeniedDataType | SpaceNotFoundDataType | SpaceOwnerNotFoundDataType | SpaceShouldHaveOnlyOneOwnerDataType | SubscriptionAlreadyExistsDataType | SubscriptionNotExistsDataType | SubscriptionPlanNotFoundDataType | UnknownOauthProviderDataType | UnsupportedSubscriptionPlanDataType | VersionRejectedDataType | WorkspaceMembersExceedLimitToDowngradeDataType | WorkspacePermissionNotFoundDataType | WrongSignInCredentialsDataType +union ErrorDataUnion = AlreadyInSpaceDataType | BlobNotFoundDataType | CopilotContextFileNotSupportedDataType | CopilotDocNotFoundDataType | CopilotFailedToMatchContextDataType | CopilotFailedToModifyContextDataType | CopilotInvalidContextDataType | CopilotMessageNotFoundDataType | CopilotPromptNotFoundDataType | CopilotProviderSideErrorDataType | DocActionDeniedDataType | DocHistoryNotFoundDataType | DocNotFoundDataType | ExpectToGrantDocUserRolesDataType | ExpectToRevokeDocUserRolesDataType | ExpectToUpdateDocUserRoleDataType | GraphqlBadRequestDataType | InvalidEmailDataType | InvalidHistoryTimestampDataType | InvalidLicenseUpdateParamsDataType | InvalidPasswordLengthDataType | InvalidRuntimeConfigTypeDataType | MemberNotFoundInSpaceDataType | MissingOauthQueryParameterDataType | NotInSpaceDataType | QueryTooLongDataType | RuntimeConfigNotFoundDataType | SameSubscriptionRecurringDataType | SpaceAccessDeniedDataType | SpaceNotFoundDataType | SpaceOwnerNotFoundDataType | SpaceShouldHaveOnlyOneOwnerDataType | SubscriptionAlreadyExistsDataType | SubscriptionNotExistsDataType | SubscriptionPlanNotFoundDataType | UnknownOauthProviderDataType | UnsupportedSubscriptionPlanDataType | VersionRejectedDataType | WorkspaceMembersExceedLimitToDowngradeDataType | WorkspacePermissionNotFoundDataType | WrongSignInCredentialsDataType enum ErrorNames { ACCESS_DENIED @@ -347,7 +348,7 @@ enum ErrorNames { COPILOT_SESSION_DELETED COPILOT_SESSION_NOT_FOUND CUSTOMER_PORTAL_CREATE_FAILED - DOC_ACCESS_DENIED + DOC_ACTION_DENIED DOC_DEFAULT_ROLE_CAN_NOT_BE_OWNER DOC_HISTORY_NOT_FOUND DOC_IS_NOT_PUBLIC diff --git a/packages/frontend/apps/android/App/service/src/main/graphql/affine/schema.graphqls b/packages/frontend/apps/android/App/service/src/main/graphql/affine/schema.graphqls index 6cf4c84139..2e16b651c5 100644 --- a/packages/frontend/apps/android/App/service/src/main/graphql/affine/schema.graphqls +++ b/packages/frontend/apps/android/App/service/src/main/graphql/affine/schema.graphqls @@ -360,7 +360,7 @@ enum ErrorNames { CUSTOMER_PORTAL_CREATE_FAILED - DOC_ACCESS_DENIED + DOC_ACTION_DENIED DOC_HISTORY_NOT_FOUND diff --git a/packages/frontend/core/src/modules/share-menu/view/share-menu/general-access/public-page-button.tsx b/packages/frontend/core/src/modules/share-menu/view/share-menu/general-access/public-page-button.tsx index 50431db1bf..2ef1d1eaab 100644 --- a/packages/frontend/core/src/modules/share-menu/view/share-menu/general-access/public-page-button.tsx +++ b/packages/frontend/core/src/modules/share-menu/view/share-menu/general-access/public-page-button.tsx @@ -1,7 +1,7 @@ import { Menu, MenuItem, MenuTrigger, notify } from '@affine/component'; import { useAsyncCallback } from '@affine/core/components/hooks/affine-async-hooks'; import { ShareInfoService } from '@affine/core/modules/share-doc'; -import { PublicDocMode } from '@affine/graphql'; +import { PublicDocMode, UserFriendlyError } from '@affine/graphql'; import { useI18n } from '@affine/i18n'; import track from '@affine/track'; import { @@ -73,18 +73,12 @@ export const PublicDoc = ({ disabled }: { disabled?: boolean }) => { style: 'normal', icon: , }); - } catch (err) { + } catch (error) { + const err = UserFriendlyError.fromAnyError(error); notify.error({ - title: - t[ - 'com.affine.share-menu.confirm-modify-mode.notification.fail.title' - ](), - message: - t[ - 'com.affine.share-menu.confirm-modify-mode.notification.fail.message' - ](), + title: err.name, + message: err.message, }); - console.error(err); } }, [isSharedPage, shareInfoService.shareInfo, t]); diff --git a/packages/frontend/graphql/src/schema.ts b/packages/frontend/graphql/src/schema.ts index d057783f2c..697a488c3b 100644 --- a/packages/frontend/graphql/src/schema.ts +++ b/packages/frontend/graphql/src/schema.ts @@ -144,6 +144,11 @@ export interface CopilotContextListItem { status: Maybe; } +export interface CopilotDocNotFoundDataType { + __typename?: 'CopilotDocNotFoundDataType'; + docId: Scalars['String']['output']; +} + export interface CopilotFailedToMatchContextDataType { __typename?: 'CopilotFailedToMatchContextDataType'; content: Scalars['String']['output']; @@ -308,8 +313,9 @@ export interface DeleteSessionInput { workspaceId: Scalars['String']['input']; } -export interface DocAccessDeniedDataType { - __typename?: 'DocAccessDeniedDataType'; +export interface DocActionDeniedDataType { + __typename?: 'DocActionDeniedDataType'; + action: Scalars['String']['output']; docId: Scalars['String']['output']; spaceId: Scalars['String']['output']; } @@ -387,18 +393,20 @@ export type ErrorDataUnion = | AlreadyInSpaceDataType | BlobNotFoundDataType | CopilotContextFileNotSupportedDataType + | CopilotDocNotFoundDataType | CopilotFailedToMatchContextDataType | CopilotFailedToModifyContextDataType | CopilotInvalidContextDataType | CopilotMessageNotFoundDataType | CopilotPromptNotFoundDataType | CopilotProviderSideErrorDataType - | DocAccessDeniedDataType + | DocActionDeniedDataType | DocHistoryNotFoundDataType | DocNotFoundDataType | ExpectToGrantDocUserRolesDataType | ExpectToRevokeDocUserRolesDataType | ExpectToUpdateDocUserRoleDataType + | GraphqlBadRequestDataType | InvalidEmailDataType | InvalidHistoryTimestampDataType | InvalidLicenseUpdateParamsDataType @@ -440,6 +448,7 @@ export enum ErrorNames { CAPTCHA_VERIFICATION_FAILED = 'CAPTCHA_VERIFICATION_FAILED', COPILOT_ACTION_TAKEN = 'COPILOT_ACTION_TAKEN', COPILOT_CONTEXT_FILE_NOT_SUPPORTED = 'COPILOT_CONTEXT_FILE_NOT_SUPPORTED', + COPILOT_DOC_NOT_FOUND = 'COPILOT_DOC_NOT_FOUND', COPILOT_FAILED_TO_CREATE_MESSAGE = 'COPILOT_FAILED_TO_CREATE_MESSAGE', COPILOT_FAILED_TO_GENERATE_TEXT = 'COPILOT_FAILED_TO_GENERATE_TEXT', COPILOT_FAILED_TO_MATCH_CONTEXT = 'COPILOT_FAILED_TO_MATCH_CONTEXT', @@ -453,7 +462,7 @@ export enum ErrorNames { COPILOT_SESSION_DELETED = 'COPILOT_SESSION_DELETED', COPILOT_SESSION_NOT_FOUND = 'COPILOT_SESSION_NOT_FOUND', CUSTOMER_PORTAL_CREATE_FAILED = 'CUSTOMER_PORTAL_CREATE_FAILED', - DOC_ACCESS_DENIED = 'DOC_ACCESS_DENIED', + DOC_ACTION_DENIED = 'DOC_ACTION_DENIED', DOC_DEFAULT_ROLE_CAN_NOT_BE_OWNER = 'DOC_DEFAULT_ROLE_CAN_NOT_BE_OWNER', DOC_HISTORY_NOT_FOUND = 'DOC_HISTORY_NOT_FOUND', DOC_IS_NOT_PUBLIC = 'DOC_IS_NOT_PUBLIC', @@ -470,6 +479,7 @@ export enum ErrorNames { FAILED_TO_CHECKOUT = 'FAILED_TO_CHECKOUT', FAILED_TO_SAVE_UPDATES = 'FAILED_TO_SAVE_UPDATES', FAILED_TO_UPSERT_SNAPSHOT = 'FAILED_TO_UPSERT_SNAPSHOT', + GRAPHQL_BAD_REQUEST = 'GRAPHQL_BAD_REQUEST', INTERNAL_SERVER_ERROR = 'INTERNAL_SERVER_ERROR', INVALID_CHECKOUT_PARAMETERS = 'INVALID_CHECKOUT_PARAMETERS', INVALID_EMAIL = 'INVALID_EMAIL', @@ -583,6 +593,12 @@ export interface GrantedDocUserTypeEdge { node: GrantedDocUserType; } +export interface GraphqlBadRequestDataType { + __typename?: 'GraphqlBadRequestDataType'; + code: Scalars['String']['output']; + message: Scalars['String']['output']; +} + export interface InvalidEmailDataType { __typename?: 'InvalidEmailDataType'; email: Scalars['String']['output']; diff --git a/packages/frontend/i18n/src/i18n-completenesses.json b/packages/frontend/i18n/src/i18n-completenesses.json index 5e156ec3d4..76f27df999 100644 --- a/packages/frontend/i18n/src/i18n-completenesses.json +++ b/packages/frontend/i18n/src/i18n-completenesses.json @@ -1,26 +1,26 @@ { - "ar": 87, + "ar": 88, "ca": 4, "da": 5, - "de": 87, - "el-GR": 87, + "de": 88, + "el-GR": 88, "en": 100, - "es-AR": 87, + "es-AR": 88, "es-CL": 89, - "es": 87, - "fa": 87, - "fr": 87, + "es": 88, + "fa": 88, + "fr": 88, "hi": 2, - "it-IT": 87, + "it-IT": 88, "it": 1, - "ja": 87, + "ja": 88, "ko": 63, - "pl": 87, - "pt-BR": 87, - "ru": 87, - "sv-SE": 87, - "uk": 87, + "pl": 88, + "pt-BR": 88, + "ru": 88, + "sv-SE": 88, + "uk": 88, "ur": 2, - "zh-Hans": 87, - "zh-Hant": 87 + "zh-Hans": 88, + "zh-Hant": 88 } diff --git a/packages/frontend/i18n/src/i18n.gen.ts b/packages/frontend/i18n/src/i18n.gen.ts index 7f443faa46..1b019ee075 100644 --- a/packages/frontend/i18n/src/i18n.gen.ts +++ b/packages/frontend/i18n/src/i18n.gen.ts @@ -5708,19 +5708,19 @@ export function useAFFiNEI18N(): { */ ["com.affine.settings.workspace.affine-ai.description"](): string; /** - * `Achieved workspaces` + * `Archived workspaces` */ ["com.affine.settings.workspace.backup"](): string; /** - * `Management in local workspace backup files` + * `Manage archived local workspace files` */ ["com.affine.settings.workspace.backup.subtitle"](): string; /** - * `No backup files found` + * `No archived workspace files found` */ ["com.affine.settings.workspace.backup.empty"](): string; /** - * `Delete backup workspace` + * `Delete archived workspace` */ ["com.affine.settings.workspace.backup.delete"](): string; /** @@ -5790,14 +5790,6 @@ export function useAFFiNEI18N(): { * `Shared doc` */ ["com.affine.share-menu.SharedPage"](): string; - /** - * `Please try again later.` - */ - ["com.affine.share-menu.confirm-modify-mode.notification.fail.message"](): string; - /** - * `Failed to modify` - */ - ["com.affine.share-menu.confirm-modify-mode.notification.fail.title"](): string; /** * `Copy Link` */ @@ -7199,11 +7191,11 @@ export function useAFFiNEI18N(): { spaceId: string; }>): string; /** - * `You do not have permission to access doc {{docId}} under Space {{spaceId}}.` + * `You do not have permission to perform {{action}} action on doc {{docId}}.` */ - ["error.DOC_ACCESS_DENIED"](options: Readonly<{ + ["error.DOC_ACTION_DENIED"](options: Readonly<{ + action: string; docId: string; - spaceId: string; }>): string; /** * `Your client with version {{version}} is rejected by remote sync server. Please upgrade to {{serverVersion}}.` diff --git a/packages/frontend/i18n/src/resources/en.json b/packages/frontend/i18n/src/resources/en.json index 9b4e728823..83c10cc3e9 100644 --- a/packages/frontend/i18n/src/resources/en.json +++ b/packages/frontend/i18n/src/resources/en.json @@ -1446,8 +1446,6 @@ "com.affine.share-menu.ShareWithLink": "Share with link", "com.affine.share-menu.ShareWithLinkDescription": "Create a link you can easily share with anyone. The visitors will open your doc in the form od a document", "com.affine.share-menu.SharedPage": "Shared doc", - "com.affine.share-menu.confirm-modify-mode.notification.fail.message": "Please try again later.", - "com.affine.share-menu.confirm-modify-mode.notification.fail.title": "Failed to modify", "com.affine.share-menu.copy": "Copy Link", "com.affine.share-menu.copy-private-link": "Copy private link", "com.affine.share-menu.copy.block": "Copy Link to Selected Block", @@ -1783,7 +1781,7 @@ "error.SPACE_OWNER_NOT_FOUND": "Owner of Space {{spaceId}} not found.", "error.SPACE_SHOULD_HAVE_ONLY_ONE_OWNER": "Space should have only one owner.", "error.DOC_NOT_FOUND": "Doc {{docId}} under Space {{spaceId}} not found.", - "error.DOC_ACCESS_DENIED": "You do not have permission to access doc {{docId}} under Space {{spaceId}}.", + "error.DOC_ACTION_DENIED": "You do not have permission to perform {{action}} action on doc {{docId}}.", "error.VERSION_REJECTED": "Your client with version {{version}} is rejected by remote sync server. Please upgrade to {{serverVersion}}.", "error.INVALID_HISTORY_TIMESTAMP": "Invalid doc history timestamp provided.", "error.DOC_HISTORY_NOT_FOUND": "History of {{docId}} at {{timestamp}} under Space {{spaceId}}.",