diff options
Diffstat (limited to 'routers/repo/issue_watch.go')
-rw-r--r-- | routers/repo/issue_watch.go | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/routers/repo/issue_watch.go b/routers/repo/issue_watch.go index c6a436801a..eae663495a 100644 --- a/routers/repo/issue_watch.go +++ b/routers/repo/issue_watch.go @@ -11,6 +11,7 @@ import ( "code.gitea.io/gitea/models" "code.gitea.io/gitea/modules/context" + "code.gitea.io/gitea/modules/log" ) // IssueWatch sets issue watching @@ -21,6 +22,23 @@ func IssueWatch(ctx *context.Context) { } if !ctx.IsSigned || (ctx.User.ID != issue.PosterID && !ctx.Repo.CanReadIssuesOrPulls(issue.IsPull)) { + if log.IsTrace() { + if ctx.IsSigned { + issueType := "issues" + if issue.IsPull { + issueType = "pulls" + } + log.Trace("Permission Denied: User %-v not the Poster (ID: %d) and cannot read %s in Repo %-v.\n"+ + "User in Repo has Permissions: %-+v", + ctx.User, + log.NewColoredIDValue(issue.PosterID), + issueType, + ctx.Repo.Repository, + ctx.Repo.Permission) + } else { + log.Trace("Permission Denied: Not logged in") + } + } ctx.Error(403) return } |