diff --git a/internal/controller/comment_controller.go b/internal/controller/comment_controller.go index 79ed9681..71e5a10a 100644 --- a/internal/controller/comment_controller.go +++ b/internal/controller/comment_controller.go @@ -8,6 +8,7 @@ import ( "github.com/answerdev/answer/internal/service/comment" "github.com/answerdev/answer/internal/service/permission" "github.com/answerdev/answer/internal/service/rank" + "github.com/answerdev/answer/pkg/uid" "github.com/gin-gonic/gin" "github.com/segmentfault/pacman/errors" ) @@ -40,7 +41,7 @@ func (cc *CommentController) AddComment(ctx *gin.Context) { if handler.BindAndCheck(ctx, req) { return } - + req.ObjectID = uid.DeShortID(req.ObjectID) req.UserID = middleware.GetLoginUserIDFromContext(ctx) canList, err := cc.rankService.CheckOperationPermissions(ctx, req.UserID, []string{ permission.CommentAdd, @@ -142,7 +143,7 @@ func (cc *CommentController) GetCommentWithPage(ctx *gin.Context) { if handler.BindAndCheck(ctx, req) { return } - + req.ObjectID = uid.DeShortID(req.ObjectID) req.UserID = middleware.GetLoginUserIDFromContext(ctx) canList, err := cc.rankService.CheckOperationPermissions(ctx, req.UserID, []string{ permission.CommentEdit,