You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@answer.apache.org by li...@apache.org on 2024/03/21 07:24:01 UTC

(incubator-answer) branch feat/1.3.0/review updated: fix(review): set correct status for question and answer that don't need review

This is an automated email from the ASF dual-hosted git repository.

linkinstar pushed a commit to branch feat/1.3.0/review
in repository https://gitbox.apache.org/repos/asf/incubator-answer.git


The following commit(s) were added to refs/heads/feat/1.3.0/review by this push:
     new 4642d7a2 fix(review): set correct status for question and answer that don't need review
4642d7a2 is described below

commit 4642d7a243bb90d51b356d614efa87d80395ab0e
Author: LinkinStars <li...@foxmail.com>
AuthorDate: Thu Mar 21 15:23:52 2024 +0800

    fix(review): set correct status for question and answer that don't need review
---
 internal/service/content/answer_service.go   | 2 ++
 internal/service/content/question_service.go | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/internal/service/content/answer_service.go b/internal/service/content/answer_service.go
index 3c8b96ee..5269d2e9 100644
--- a/internal/service/content/answer_service.go
+++ b/internal/service/content/answer_service.go
@@ -243,6 +243,8 @@ func (as *AnswerService) Insert(ctx context.Context, req *schema.AnswerAddReq) (
 	if as.reviewService.AddAnswerReview(ctx, insertData) {
 		if err := as.answerRepo.UpdateAnswerStatus(ctx, insertData.ID, entity.AnswerStatusAvailable); err != nil {
 			return "", err
+		} else {
+			insertData.Status = entity.AnswerStatusAvailable
 		}
 	}
 	err = as.questionCommon.UpdateAnswerCount(ctx, req.QuestionID)
diff --git a/internal/service/content/question_service.go b/internal/service/content/question_service.go
index 7d77213e..e4f2b499 100644
--- a/internal/service/content/question_service.go
+++ b/internal/service/content/question_service.go
@@ -330,6 +330,8 @@ func (qs *QuestionService) AddQuestion(ctx context.Context, req *schema.Question
 	if qs.reviewService.AddQuestionReview(ctx, question, req.Tags) {
 		if err := qs.questionRepo.UpdateQuestionStatus(ctx, question.ID, entity.QuestionStatusAvailable); err != nil {
 			return nil, err
+		} else {
+			question.Status = entity.AnswerStatusAvailable
 		}
 	}
 	objectTagData := schema.TagChange{}