mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-11-26 19:04:23 +00:00
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:
@@ -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),
|
||||
|
||||
Reference in New Issue
Block a user