mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-11-27 03:14:11 +00:00
feat(comments): add internal comments and author comment editing (#552)
* feat(comments): add internal comments and author comment editing * chore(i18n): add Korean comment translations and update AGENTS.md i18n rule * style(comments): refine visibility selector corner radius and align send button height * fix(webui): avoid ResizeObserver loop when resizing file browser
This commit is contained in:
@@ -18,6 +18,7 @@ import {
|
||||
import {
|
||||
archiveAssetsRequestSchema,
|
||||
createCommentRequestSchema,
|
||||
updateCommentRequestSchema,
|
||||
deleteFilesRequestSchema,
|
||||
batchGetFilesRequestSchema,
|
||||
paginationParamsSchema,
|
||||
@@ -199,6 +200,7 @@ const route = new Hono<{ Variables: { user: User } }>()
|
||||
annotations: req.annotations,
|
||||
second: req.second,
|
||||
attachmentIds: req.attachmentIds,
|
||||
isInternal: req.isInternal,
|
||||
})
|
||||
|
||||
const context = await assetService.getAssetContext(fileId)
|
||||
@@ -361,6 +363,38 @@ const route = new Hono<{ Variables: { user: User } }>()
|
||||
return c.json(await assetService.getComment(commentId, user.id))
|
||||
},
|
||||
)
|
||||
.patch('/comments/:commentId', zValidator('json', updateCommentRequestSchema), async (c) => {
|
||||
const commentId = c.req.param('commentId')
|
||||
const user = c.get('user')
|
||||
const req = c.req.valid('json')
|
||||
|
||||
await authzService.hasPermission({
|
||||
user,
|
||||
permission: Permission.Read,
|
||||
type: ResourceType.Comment,
|
||||
id: commentId,
|
||||
})
|
||||
|
||||
const updated = await assetService.updateComment({
|
||||
commentId,
|
||||
userId: user.id,
|
||||
message: req.message,
|
||||
isInternal: req.isInternal,
|
||||
second: req.second,
|
||||
attachmentIds: req.attachmentIds,
|
||||
})
|
||||
|
||||
const context = await assetService.getAssetContext(updated.assetId)
|
||||
await auditLogService.logAction({
|
||||
action: AuditAction.comment_update,
|
||||
teamId: context.teamId,
|
||||
userId: user.id,
|
||||
projectId: context.projectId,
|
||||
itemId: commentId,
|
||||
})
|
||||
|
||||
return c.json(updated)
|
||||
})
|
||||
.delete('/comments/:commentId', async (c) => {
|
||||
const commentId = c.req.param('commentId')
|
||||
const user = c.get('user')
|
||||
|
||||
Reference in New Issue
Block a user