restrict v8

This commit is contained in:
tamakyi
2026-10-18 23:32:38 +08:00
parent 317c96ca17
commit 7a6417c33d
21 changed files with 626 additions and 21 deletions
+11
View File
@@ -272,6 +272,12 @@ func Delete(ctx context.Context, pageUser *db.User, question *db.Question, canDe
return
}
// 举报闭环:内容已被箱主处理掉,该题下的待处理举报不应再计入告警阈值。
// 这一步失败不影响删除结果,只记日志 —— 让一次统计失败回滚用户操作是不可接受的。
if _, err := db.Reports.MarkAcceptedByQuestion(ctx.Request().Context(), question.ID); err != nil {
logrus.WithContext(ctx.Request().Context()).WithError(err).Error("Failed to mark reports accepted after delete")
}
ctx.Redirect("/_/" + pageUser.Domain)
}
@@ -288,6 +294,11 @@ func SetPrivate(ctx context.Context, pageUser *db.User, question *db.Question, c
return
}
// 举报闭环:设为私密等于箱主已响应,该题的待处理举报移出统计池(见 report.go 的说明)。
if _, err := db.Reports.MarkAcceptedByQuestion(ctx.Request().Context(), question.ID); err != nil {
logrus.WithContext(ctx.Request().Context()).WithError(err).Error("Failed to mark reports accepted after set private")
}
ctx.Redirect(fmt.Sprintf("/_/%s/%d", pageUser.Domain, question.ID))
}