restrict v7

This commit is contained in:
tamakyi
2026-10-18 23:04:50 +08:00
parent bd81398a06
commit 317c96ca17
15 changed files with 128 additions and 13 deletions
+3 -2
View File
@@ -185,12 +185,13 @@ func AnswerFollowUp(ctx context.Context, pageUser *db.User, question *db.Questio
if err := db.FollowUps.UpdateAnswerByID(ctx.Request().Context(), question.ID, followUpID, f.Answer); err != nil {
if errors.Is(err, db.ErrFollowUpNotFound) {
ctx.SetErrorFlash(i18n.T(ctx.Lang(), "followup.errNotFound"))
// 同请求渲染需用 SetError(SetErrorFlash 要等下一次请求才显示)。
ctx.SetError(errors.New(i18n.T(ctx.Lang(), "followup.errNotFound")), f)
ctx.Success("question/item")
return
}
logrus.WithContext(ctx.Request().Context()).WithError(err).Error("Failed to answer follow up")
ctx.SetInternalErrorFlash()
ctx.SetInternalError()
ctx.Success("question/item")
return
}