Check permission for the appropriate unit type (#14261)

* Check permission for the appropriate unit type

Fixes false positives for "User created Issues in Repository which they no longer have access to" errors

* change log level to Debug

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
release/v1.15
Jimmy Praet 2021-01-06 06:07:58 +01:00 committed by GitHub
parent d1581a4563
commit 8224f03a23
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -551,8 +551,8 @@ func Issues(ctx *context.Context) {
ctx.ServerError("GetUserRepoPermission", fmt.Errorf("[%d]%v", repoID, err))
return
}
if !perm.CanRead(models.UnitTypeIssues) {
log.Error("User created Issues in Repository which they no longer have access to: [%d]", repoID)
if !perm.CanRead(unitType) {
log.Debug("User created Issues in Repository which they no longer have access to: [%d]", repoID)
}
}
}