A Q&A platform software for teams at any scales. Whether it's a community forum, help center, or knowledge management platform, you can always count on Apache Answer.
fix(review): get review flag comment without status
LinkinStars7e147874ac5a
diff --git a/internal/repo/comment/comment_repo.go b/internal/repo/comment/comment_repo.goindex 0969ee47..79f0eaa9 100644--- a/internal/repo/comment/comment_repo.go+++ b/internal/repo/comment/comment_repo.go@@ -21,6 +21,7 @@ package commentimport ("context"+"github.com/segmentfault/pacman/log""github.com/apache/incubator-answer/internal/base/data"@@ -102,6 +103,17 @@ func (cr *commentRepo) GetComment(ctx context.Context, commentID string) (return}+// GetCommentWithoutStatus get comment one without status+func (cr *commentRepo) GetCommentWithoutStatus(ctx context.Context, commentID string) (+ comment *entity.Comment, exist bool, err error) {+ comment = &entity.Comment{}+ exist, err = cr.data.DB.Context(ctx).ID(commentID).Get(comment)+ if err != nil {+ err = errors.InternalServer(reason.DatabaseError).WithError(err).WithStack()+ }+ return+}+func (cr *commentRepo) GetCommentCount(ctx context.Context) (count int64, err error) {list := make([]*entity.Comment, 0)count, err = cr.data.DB.Context(ctx).Where("status = ?", entity.CommentStatusAvailable).FindAndCount(&list)diff --git a/internal/service/comment_common/comment_service.go b/internal/service/comment_common/comment_service.goindex eea32e6c..3554a358 100644--- a/internal/service/comment_common/comment_service.go+++ b/internal/service/comment_common/comment_service.go@@ -31,6 +31,7 @@ import (// CommentCommonRepo comment repositorytype CommentCommonRepo interface {GetComment(ctx context.Context, commentID string) (comment *entity.Comment, exist bool, err error)+ GetCommentWithoutStatus(ctx context.Context, commentID string) (comment *entity.Comment, exist bool, err error)GetCommentCount(ctx context.Context) (count int64, err error)RemoveAllUserComment(ctx context.Context, userID string) (err error)}diff --git a/internal/service/object_info/object_info.go b/internal/service/object_info/object_info.goindex e20d24b7..4f000900 100644--- a/internal/service/object_info/object_info.go+++ b/internal/service/object_info/object_info.go@@ -152,7 +152,7 @@ func (os *ObjService) GetUnreviewedRevisionInfo(ctx context.Context, objectID stStatus: tagInfo.Status,}case constant.CommentObjectType:- commentInfo, exist, err := os.commentRepo.GetComment(ctx, objectID)+ commentInfo, exist, err := os.commentRepo.GetCommentWithoutStatus(ctx, objectID)if err != nil {return nil, err}