parent
e459f99ef2
commit
e43de0db4c
|
@ -285,7 +285,9 @@ func Issues(ctx *context.Context) {
|
||||||
}
|
}
|
||||||
opts.LabelIDs = labelIDs
|
opts.LabelIDs = labelIDs
|
||||||
|
|
||||||
|
if len(repoIDs) > 0 {
|
||||||
opts.RepoIDs = repoIDs
|
opts.RepoIDs = repoIDs
|
||||||
|
}
|
||||||
|
|
||||||
issues, err := models.Issues(opts)
|
issues, err := models.Issues(opts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -295,7 +297,9 @@ 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 _, ok := showReposMap[repoID]; !ok {
|
||||||
|
repo, err := models.GetRepositoryByID(repoID)
|
||||||
if models.IsErrRepoNotExist(err) {
|
if models.IsErrRepoNotExist(err) {
|
||||||
ctx.NotFound("GetRepositoryByID", err)
|
ctx.NotFound("GetRepositoryByID", err)
|
||||||
return
|
return
|
||||||
|
@ -303,9 +307,12 @@ func Issues(ctx *context.Context) {
|
||||||
ctx.ServerError("GetRepositoryByID", fmt.Errorf("[%d]%v", repoID, err))
|
ctx.ServerError("GetRepositoryByID", fmt.Errorf("[%d]%v", repoID, err))
|
||||||
return
|
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
|
||||||
|
@ -314,6 +321,7 @@ func Issues(ctx *context.Context) {
|
||||||
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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
showRepos := models.RepositoryListOfMap(showReposMap)
|
showRepos := models.RepositoryListOfMap(showReposMap)
|
||||||
sort.Sort(showRepos)
|
sort.Sort(showRepos)
|
||||||
|
|
Loading…
Reference in New Issue