aboutsummaryrefslogtreecommitdiffstats
path: root/routers/web/repo/issue_content_history.go
diff options
context:
space:
mode:
Diffstat (limited to 'routers/web/repo/issue_content_history.go')
-rw-r--r--routers/web/repo/issue_content_history.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/routers/web/repo/issue_content_history.go b/routers/web/repo/issue_content_history.go
index fce0eccc7b..1ec497658f 100644
--- a/routers/web/repo/issue_content_history.go
+++ b/routers/web/repo/issue_content_history.go
@@ -94,7 +94,7 @@ func canSoftDeleteContentHistory(ctx *context.Context, issue *issues_model.Issue
// CanWrite means the doer can manage the issue/PR list
if ctx.Repo.IsOwner() || ctx.Repo.CanWriteIssuesOrPulls(issue.IsPull) {
canSoftDelete = true
- } else {
+ } else if ctx.Doer != nil {
// for read-only users, they could still post issues or comments,
// they should be able to delete the history related to their own issue/comment, a case is:
// 1. the user posts some sensitive data
@@ -186,6 +186,10 @@ func SoftDeleteContentHistory(ctx *context.Context) {
if ctx.Written() {
return
}
+ if ctx.Doer == nil {
+ ctx.NotFound("Require SignIn", nil)
+ return
+ }
commentID := ctx.FormInt64("comment_id")
historyID := ctx.FormInt64("history_id")