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.
update del Answer
aichy126c413bf3b0935
diff --git a/internal/service/answer_service.go b/internal/service/answer_service.goindex 2839e94d..30f8e42d 100644--- a/internal/service/answer_service.go+++ b/internal/service/answer_service.go@@ -76,9 +76,25 @@ func (as *AnswerService) RemoveAnswer(ctx context.Context, req *schema.RemoveAnsif answerInfo.UserID != req.UserID {return errors.BadRequest(reason.UnauthorizedError)}+ if answerInfo.VoteCount > 0 {+ return errors.BadRequest(reason.UnauthorizedError)+ }if answerInfo.Adopted == schema.AnswerAdoptedEnable {return errors.BadRequest(reason.UnauthorizedError)}+ questionInfo, exist, err := as.questionRepo.GetQuestion(ctx, answerInfo.QuestionID)+ if err != nil {+ return errors.BadRequest(reason.UnauthorizedError)+ }+ if !exist {+ return errors.BadRequest(reason.UnauthorizedError)+ }+ if questionInfo.AnswerCount > 1 {+ return errors.BadRequest(reason.UnauthorizedError)+ }+ if questionInfo.AcceptedAnswerID != "" {+ return errors.BadRequest(reason.UnauthorizedError)+ }// user add question counterr = as.questionCommon.UpdateAnswerCount(ctx, answerInfo.QuestionID, -1)