mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-16 01:26:37 +08:00
feat(server): comment service and resolver (#12761)
close CLOUD-227 close CLOUD-230 #### PR Dependency Tree * **PR #12761** 👈 * **PR #12924** * **PR #12925** This tree was auto-generated by [Charcoal](https://github.com/danerwilliams/charcoal) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Introduced a comprehensive commenting system, enabling users to create, update, resolve, and delete comments and replies on documents. * Added support for uploading attachments to comments, with clear error messaging if size limits are exceeded. * Implemented role-based permissions for comment actions, including a new "Commenter" role. * Enabled paginated listing and change tracking of comments and replies via GraphQL queries. * Provided full localization and error handling for comment-related actions. * **Bug Fixes** * Improved uniqueness handling when fetching user data for comments and replies. * **Documentation** * Extended GraphQL schema and frontend localization to document and support new comment features. * **Tests** * Added extensive backend test suites covering all comment and reply functionalities, permissions, and attachment uploads. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -921,4 +921,8 @@ export const USER_FRIENDLY_ERRORS = {
|
||||
type: 'resource_not_found',
|
||||
message: 'Comment attachment not found.',
|
||||
},
|
||||
comment_attachment_quota_exceeded: {
|
||||
type: 'quota_exceeded',
|
||||
message: 'You have exceeded the comment attachment size quota.',
|
||||
},
|
||||
} satisfies Record<string, UserFriendlyErrorOptions>;
|
||||
|
||||
@@ -1085,6 +1085,12 @@ export class CommentAttachmentNotFound extends UserFriendlyError {
|
||||
super('resource_not_found', 'comment_attachment_not_found', message);
|
||||
}
|
||||
}
|
||||
|
||||
export class CommentAttachmentQuotaExceeded extends UserFriendlyError {
|
||||
constructor(message?: string) {
|
||||
super('quota_exceeded', 'comment_attachment_quota_exceeded', message);
|
||||
}
|
||||
}
|
||||
export enum ErrorNames {
|
||||
INTERNAL_SERVER_ERROR,
|
||||
NETWORK_ERROR,
|
||||
@@ -1223,7 +1229,8 @@ export enum ErrorNames {
|
||||
INVALID_INDEXER_INPUT,
|
||||
COMMENT_NOT_FOUND,
|
||||
REPLY_NOT_FOUND,
|
||||
COMMENT_ATTACHMENT_NOT_FOUND
|
||||
COMMENT_ATTACHMENT_NOT_FOUND,
|
||||
COMMENT_ATTACHMENT_QUOTA_EXCEEDED
|
||||
}
|
||||
registerEnumType(ErrorNames, {
|
||||
name: 'ErrorNames'
|
||||
|
||||
Reference in New Issue
Block a user