@@ -285,9 +285,7 @@ func Issues(ctx *context.Context) {
285
285
}
286
286
opts .LabelIDs = labelIDs
287
287
288
- if len (repoIDs ) > 0 {
289
- opts .RepoIDs = repoIDs
290
- }
288
+ opts .RepoIDs = repoIDs
291
289
292
290
issues , err := models .Issues (opts )
293
291
if err != nil {
@@ -297,30 +295,23 @@ func Issues(ctx *context.Context) {
297
295
298
296
showReposMap := make (map [int64 ]* models.Repository , len (counts ))
299
297
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
+ }
314
306
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 )
324
315
}
325
316
}
326
317
0 commit comments