fix version 1
This commit is contained in:
@@ -14,13 +14,21 @@ import (
|
||||
|
||||
// 修改评论
|
||||
func ModifyComment(ctx context.Context, in *pb.CommentItem) (*pb.StatusReply, error) {
|
||||
_, err := service.ParseMetaCtx(ctx, nil)
|
||||
auth, err := service.ParseMetaCtx(ctx, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if in.GetIdentity() == "" {
|
||||
return nil, errcode.ErrInvalidArgument
|
||||
}
|
||||
// 校验归属:仅评论作者可修改
|
||||
comment, err := models.GetCommentForAuth(in.Identity)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if comment.OwnerIdentity != auth.Identity {
|
||||
return nil, errcode.ErrPermissionDenied
|
||||
}
|
||||
|
||||
var data = models.CmsComment{
|
||||
Std_Identity: types.Std_Identity{Identity: in.Identity},
|
||||
|
||||
Reference in New Issue
Block a user