mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-12-22 12:54:53 -05:00
parent
e459f99ef2
commit
e43de0db4c
1 changed files with 25 additions and 17 deletions
|
@ -285,7 +285,9 @@ func Issues(ctx *context.Context) {
|
||||||
}
|
}
|
||||||
opts.LabelIDs = labelIDs
|
opts.LabelIDs = labelIDs
|
||||||
|
|
||||||
opts.RepoIDs = repoIDs
|
if len(repoIDs) > 0 {
|
||||||
|
opts.RepoIDs = repoIDs
|
||||||
|
}
|
||||||
|
|
||||||
issues, err := models.Issues(opts)
|
issues, err := models.Issues(opts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -295,23 +297,29 @@ func Issues(ctx *context.Context) {
|
||||||
|
|
||||||
showReposMap := make(map[int64]*models.Repository, len(counts))
|
showReposMap := make(map[int64]*models.Repository, len(counts))
|
||||||
for repoID := range counts {
|
for repoID := range counts {
|
||||||
showReposMap[repoID], err = models.GetRepositoryByID(repoID)
|
if repoID > 0 {
|
||||||
if models.IsErrRepoNotExist(err) {
|
if _, ok := showReposMap[repoID]; !ok {
|
||||||
ctx.NotFound("GetRepositoryByID", err)
|
repo, err := models.GetRepositoryByID(repoID)
|
||||||
return
|
if models.IsErrRepoNotExist(err) {
|
||||||
} else if err != nil {
|
ctx.NotFound("GetRepositoryByID", err)
|
||||||
ctx.ServerError("GetRepositoryByID", fmt.Errorf("[%d]%v", repoID, err))
|
return
|
||||||
return
|
} else if err != nil {
|
||||||
}
|
ctx.ServerError("GetRepositoryByID", fmt.Errorf("[%d]%v", repoID, err))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
showReposMap[repoID] = repo
|
||||||
|
}
|
||||||
|
repo := showReposMap[repoID]
|
||||||
|
|
||||||
// Check if user has access to given repository.
|
// Check if user has access to given repository.
|
||||||
perm, err := models.GetUserRepoPermission(showReposMap[repoID], ctxUser)
|
perm, err := models.GetUserRepoPermission(repo, ctxUser)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.ServerError("GetUserRepoPermission", fmt.Errorf("[%d]%v", repoID, err))
|
ctx.ServerError("GetUserRepoPermission", fmt.Errorf("[%d]%v", repoID, err))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if !perm.CanRead(models.UnitTypeIssues) {
|
if !perm.CanRead(models.UnitTypeIssues) {
|
||||||
log.Error("User created Issues in Repository which they no longer have access to: [%d]", repoID)
|
log.Error("User created Issues in Repository which they no longer have access to: [%d]", repoID)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue