restrict v5
This commit is contained in:
@@ -167,7 +167,8 @@ func AnswerFollowUp(ctx context.Context, pageUser *db.User, question *db.Questio
|
||||
return
|
||||
}
|
||||
if db.RestrictionAtLeast(restrictionLevel, db.RestrictionL2) {
|
||||
ctx.SetErrorFlash(i18n.T(ctx.Lang(), "question.errRestrictedPublish"))
|
||||
// 同请求渲染,用 SetError(SetErrorFlash 要等下一次请求才显示)。
|
||||
ctx.SetError(errors.New(i18n.T(ctx.Lang(), "question.errRestrictedPublish")), f)
|
||||
ctx.Success("question/item")
|
||||
return
|
||||
}
|
||||
@@ -176,7 +177,8 @@ func AnswerFollowUp(ctx context.Context, pageUser *db.User, question *db.Questio
|
||||
|
||||
// 内容安全检测:统一守卫,箱主本人回复同样按自己的审核严格度裁决。
|
||||
if _, err := moderation.Check(ctx.Request().Context(), moderation.StrictnessFor(pageUser.ModerationStrictness), ctx.Lang(), f.Answer); err != nil {
|
||||
ctx.SetErrorFlash(err.Error())
|
||||
// 同请求渲染,用 SetError;原先的 SetErrorFlash 在这里不会显示出来(既有缺陷)。
|
||||
ctx.SetError(err, f)
|
||||
ctx.Success("question/item")
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user