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.

feat(question): Tell the user whether to enter the audit state when modifying the question

LinkinStar9a8bb76e20a2
diff --git a/internal/controller/answer_controller.go b/internal/controller/answer_controller.go
index 94105ba4..615dd639 100644
--- a/internal/controller/answer_controller.go
+++ b/internal/controller/answer_controller.go
@@ -179,21 +179,12 @@ func (ac *AnswerController) Update(ctx *gin.Context) {
handler.HandleResponse(ctx, err, nil)
return
}
- info, questionInfo, has, err := ac.answerService.Get(ctx, req.ID, req.UserID)
+ _, _, _, err = ac.answerService.Get(ctx, req.ID, req.UserID)
if err != nil {
handler.HandleResponse(ctx, err, nil)
return
}
- if !has {
- // todo !has
- handler.HandleResponse(ctx, nil, nil)
- return
- }
- handler.HandleResponse(ctx, nil, &schema.AnswerUpdateResp{
- AnswerInfo: info,
- QuestionInfo: questionInfo,
- WaitForReview: !req.NoNeedReview,
- })
+ handler.HandleResponse(ctx, nil, &schema.AnswerUpdateResp{WaitForReview: !req.NoNeedReview})
}
// AnswerList godoc
diff --git a/internal/controller/question_controller.go b/internal/controller/question_controller.go
index 25ddcfd4..2fe17320 100644
--- a/internal/controller/question_controller.go
+++ b/internal/controller/question_controller.go
@@ -266,8 +266,8 @@ func (qc *QuestionController) UpdateQuestion(ctx *gin.Context) {
return
}
- resp, err := qc.questionService.UpdateQuestion(ctx, req)
- handler.HandleResponse(ctx, err, resp)
+ _, err = qc.questionService.UpdateQuestion(ctx, req)
+ handler.HandleResponse(ctx, err, &schema.UpdateQuestionResp{WaitForReview: !req.NoNeedReview})
}
// CloseMsgList close question msg list
diff --git a/internal/schema/answer_schema.go b/internal/schema/answer_schema.go
index 71e8a7f6..0a88eefa 100644
--- a/internal/schema/answer_schema.go
+++ b/internal/schema/answer_schema.go
@@ -36,9 +36,7 @@ type AnswerUpdateReq struct {
// AnswerUpdateResp answer update resp
type AnswerUpdateResp struct {
- AnswerInfo *AnswerInfo `json:"info"`
- QuestionInfo *QuestionInfo `json:"question"`
- WaitForReview bool `json:"wait_for_review"`
+ WaitForReview bool `json:"wait_for_review"`
}
type AnswerListReq struct {
diff --git a/internal/schema/question_schema.go b/internal/schema/question_schema.go
index 55ca661d..f9be0293 100644
--- a/internal/schema/question_schema.go
+++ b/internal/schema/question_schema.go
@@ -120,6 +120,11 @@ type QuestionInfo struct {
MemberActions []*PermissionMemberAction `json:"member_actions"`
}
+// UpdateQuestionResp update question resp
+type UpdateQuestionResp struct {
+ WaitForReview bool `json:"wait_for_review"`
+}
+
type AdminQuestionInfo struct {
ID string `json:"id"`
Title string `json:"title"`