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.

update answer

aichy126f85304f2b97b
diff --git a/internal/service/answer_service.go b/internal/service/answer_service.go
index a5a23bbe..5d854b5d 100644
--- a/internal/service/answer_service.go
+++ b/internal/service/answer_service.go
@@ -92,16 +92,14 @@ func (as *AnswerService) RemoveAnswer(ctx context.Context, req *schema.RemoveAns
if answerInfo.Accepted == schema.AnswerAcceptedEnable {
return errors.BadRequest(reason.AnswerCannotDeleted)
}
- questionInfo, exist, err := as.questionRepo.GetQuestion(ctx, answerInfo.QuestionID)
+ _, exist, err := as.questionRepo.GetQuestion(ctx, answerInfo.QuestionID)
if err != nil {
return errors.BadRequest(reason.AnswerCannotDeleted)
}
if !exist {
return errors.BadRequest(reason.AnswerCannotDeleted)
}
- if questionInfo.AcceptedAnswerID != "" {
- return errors.BadRequest(reason.AnswerCannotDeleted)
- }
+
}
// user add question count