mirror of https://gitee.com/answerdev/answer.git
Merge branch 'feat/0.5.0/timeline_ai' into test
This commit is contained in:
commit
3878e47ab9
|
@ -188,9 +188,10 @@ func (ac *AnswerController) Update(ctx *gin.Context) {
|
|||
handler.HandleResponse(ctx, nil, nil)
|
||||
return
|
||||
}
|
||||
handler.HandleResponse(ctx, nil, gin.H{
|
||||
"info": info,
|
||||
"question": questionInfo,
|
||||
handler.HandleResponse(ctx, nil, &schema.AnswerUpdateResp{
|
||||
AnswerInfo: info,
|
||||
QuestionInfo: questionInfo,
|
||||
WaitForReview: !req.NoNeedReview,
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
@ -108,7 +108,11 @@ func (tc *TagController) UpdateTag(ctx *gin.Context) {
|
|||
req.NoNeedReview = canList[1]
|
||||
|
||||
err = tc.tagService.UpdateTag(ctx, req)
|
||||
handler.HandleResponse(ctx, err, nil)
|
||||
if err != nil {
|
||||
handler.HandleResponse(ctx, err, nil)
|
||||
} else {
|
||||
handler.HandleResponse(ctx, err, &schema.UpdateTagResp{WaitForReview: !req.NoNeedReview})
|
||||
}
|
||||
}
|
||||
|
||||
// GetTagInfo get tag one
|
||||
|
|
|
@ -29,12 +29,18 @@ type AnswerUpdateReq struct {
|
|||
Content string `json:"content"` // content
|
||||
HTML string `json:"html" ` // html
|
||||
EditSummary string `validate:"omitempty" json:"edit_summary"` // edit_summary
|
||||
IsAdmin bool `json:"-"`
|
||||
NoNeedReview bool `json:"-"`
|
||||
// whether user can edit it
|
||||
CanEdit bool `json:"-"`
|
||||
}
|
||||
|
||||
// AnswerUpdateResp answer update resp
|
||||
type AnswerUpdateResp struct {
|
||||
AnswerInfo *AnswerInfo `json:"info"`
|
||||
QuestionInfo *QuestionInfo `json:"question"`
|
||||
WaitForReview bool `json:"wait_for_review"`
|
||||
}
|
||||
|
||||
type AnswerListReq struct {
|
||||
QuestionID string `json:"question_id" form:"question_id"` // question_id
|
||||
Order string `json:"order" form:"order"` // 1 Default 2 time
|
||||
|
|
|
@ -157,7 +157,6 @@ type UpdateTagReq struct {
|
|||
EditSummary string `validate:"omitempty" json:"edit_summary"`
|
||||
// user id
|
||||
UserID string `json:"-"`
|
||||
IsAdmin bool `json:"-"`
|
||||
NoNeedReview bool `json:"-"`
|
||||
}
|
||||
|
||||
|
@ -168,6 +167,11 @@ func (r *UpdateTagReq) Check() (errFields []*validator.FormErrorField, err error
|
|||
return nil, nil
|
||||
}
|
||||
|
||||
// UpdateTagResp update tag response
|
||||
type UpdateTagResp struct {
|
||||
WaitForReview bool `json:"wait_for_review"`
|
||||
}
|
||||
|
||||
// GetTagWithPageReq get tag list page request
|
||||
type GetTagWithPageReq struct {
|
||||
// page
|
||||
|
|
|
@ -246,7 +246,7 @@ func (as *AnswerService) Update(ctx context.Context, req *schema.AnswerUpdateReq
|
|||
Log: req.EditSummary,
|
||||
}
|
||||
|
||||
if req.NoNeedReview || req.IsAdmin || answerInfo.UserID == req.UserID {
|
||||
if req.NoNeedReview || answerInfo.UserID == req.UserID {
|
||||
canUpdate = true
|
||||
}
|
||||
|
||||
|
|
|
@ -657,7 +657,7 @@ func (ts *TagCommonService) UpdateTag(ctx context.Context, req *schema.UpdateTag
|
|||
Log: req.EditSummary,
|
||||
}
|
||||
|
||||
if req.IsAdmin || req.NoNeedReview {
|
||||
if req.NoNeedReview {
|
||||
canUpdate = true
|
||||
err = ts.tagRepo.UpdateTag(ctx, tagInfo)
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in New Issue