Skip to content

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.

fixes issue with deleted comments (#796)

zahashd1a0e6cfaf85
diff --git a/internal/repo/comment/comment_repo.go b/internal/repo/comment/comment_repo.go
index c8a135cf..0969ee47 100644
--- a/internal/repo/comment/comment_repo.go
+++ b/internal/repo/comment/comment_repo.go
@@ -95,7 +95,7 @@ func (cr *commentRepo) UpdateCommentContent(
func (cr *commentRepo) GetComment(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)
+ exist, err = cr.data.DB.Context(ctx).Where("status = ?", entity.CommentStatusAvailable).ID(commentID).Get(comment)
if err != nil {
err = errors.InternalServer(reason.DatabaseError).WithError(err).WithStack()
}