@@ -285,9 +285,7 @@ func Issues(ctx *context.Context) {
285285 }
286286 opts .LabelIDs = labelIDs
287287
288- if len (repoIDs ) > 0 {
289- opts .RepoIDs = repoIDs
290- }
288+ opts .RepoIDs = repoIDs
291289
292290 issues , err := models .Issues (opts )
293291 if err != nil {
@@ -297,30 +295,23 @@ func Issues(ctx *context.Context) {
297295
298296 showReposMap := make (map [int64 ]* models.Repository , len (counts ))
299297 for repoID := range counts {
300- if repoID > 0 {
301- if _ , ok := showReposMap [repoID ]; ! ok {
302- repo , err := models .GetRepositoryByID (repoID )
303- if models .IsErrRepoNotExist (err ) {
304- ctx .NotFound ("GetRepositoryByID" , err )
305- return
306- } else if err != nil {
307- ctx .ServerError ("GetRepositoryByID" , fmt .Errorf ("[%d]%v" , repoID , err ))
308- return
309- }
310- showReposMap [repoID ] = repo
311- }
312-
313- repo := showReposMap [repoID ]
298+ showReposMap [repoID ], err = models .GetRepositoryByID (repoID )
299+ if models .IsErrRepoNotExist (err ) {
300+ ctx .NotFound ("GetRepositoryByID" , err )
301+ return
302+ } else if err != nil {
303+ ctx .ServerError ("GetRepositoryByID" , fmt .Errorf ("[%d]%v" , repoID , err ))
304+ return
305+ }
314306
315- // Check if user has access to given repository.
316- perm , err := models .GetUserRepoPermission (repo , ctxUser )
317- if err != nil {
318- ctx .ServerError ("GetUserRepoPermission" , fmt .Errorf ("[%d]%v" , repoID , err ))
319- return
320- }
321- if ! perm .CanRead (models .UnitTypeIssues ) {
322- log .Error ("User created Issues in Repository which they no longer have access to: [%d]" , repoID )
323- }
307+ // Check if user has access to given repository.
308+ perm , err := models .GetUserRepoPermission (showReposMap [repoID ], ctxUser )
309+ if err != nil {
310+ ctx .ServerError ("GetUserRepoPermission" , fmt .Errorf ("[%d]%v" , repoID , err ))
311+ return
312+ }
313+ if ! perm .CanRead (models .UnitTypeIssues ) {
314+ log .Error ("User created Issues in Repository which they no longer have access to: [%d]" , repoID )
324315 }
325316 }
326317
0 commit comments