feat(comment): add emoji reaction support for comments (#405)

* feat(comment): add emoji reaction support for comments

* fix(webui): adjust emoji picker trigger icon size to match mark-done icon

* fix(webui): prevent search icon and placeholder overlap in emoji picker

* fix(webui): use normal text color for reaction count

* feat(db): limit comment reaction code column to VarChar(32)
This commit is contained in:
Yiling-J
2026-09-14 15:01:36 +08:00
committed by GitHub
parent ede52e5009
commit def42cd000
29 changed files with 3084 additions and 41 deletions
+43 -1
View File
@@ -18,6 +18,8 @@ import {
getDownloadLinksRequestSchema,
completeCommentRequestSchema,
exportCommentsRequestSchema,
addCommentReactionRequestSchema,
removeCommentReactionRequestSchema,
AuditAction,
} from '@shumai/dtos'
import { transcodeService, buildContentDisposition } from '@shumai/core'
@@ -225,7 +227,7 @@ const route = new Hono<{ Variables: { user: User } }>()
id: fileId,
})
const comments = await assetService.listComments(fileId, req)
const comments = await assetService.listComments(fileId, req, user.id)
return c.json(comments)
})
.post(
@@ -250,6 +252,46 @@ const route = new Hono<{ Variables: { user: User } }>()
return c.body(result.content)
},
)
.post(
'/comments/:commentId/reactions',
zValidator('json', addCommentReactionRequestSchema),
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,
})
await assetService.addCommentReaction(commentId, user.id, req.code)
return c.json({ success: true })
},
)
.delete(
'/comments/:commentId/reactions',
zValidator('json', removeCommentReactionRequestSchema),
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,
})
await assetService.removeCommentReaction(commentId, user.id, req.code)
return c.json({ success: true })
},
)
.post(
'/comments/:commentId/complete',
zValidator('json', completeCommentRequestSchema),