Browse Source

bug fixed on issues and pulls

Lunny Xiao 3 years ago
parent
commit
9c645b54dc
2 changed files with 21 additions and 9 deletions
  1. 0 1
      models/org.go
  2. 21 8
      routers/user/home.go

+ 0 - 1
models/org.go

@@ -657,7 +657,6 @@ func (env *accessibleReposEnv) Repos(page, pageSize int) ([]*Repository, error)
657 657
 	}
658 658
 
659 659
 	repos := make([]*Repository, 0, len(repoIDs))
660
-
661 660
 	if len(repoIDs) <= 0 {
662 661
 		return repos, nil
663 662
 	}

+ 21 - 8
routers/user/home.go

@@ -227,22 +227,35 @@ func Issues(ctx *context.Context) {
227 227
 			ctx.Handle(500, "GetRepositories", err)
228 228
 			return
229 229
 		}
230
+
231
+		for _, repo := range repos {
232
+			if (isPullList && repo.NumPulls == 0) ||
233
+				(!isPullList &&
234
+					(!repo.EnableUnit(models.UnitTypeIssues) || repo.NumIssues == 0)) {
235
+				continue
236
+			}
237
+
238
+			userRepoIDs = append(userRepoIDs, repo.ID)
239
+		}
240
+
241
+		if len(userRepoIDs) <= 0 {
242
+			userRepoIDs = []int64{-1}
243
+		}
244
+
230 245
 	} else {
231 246
 		if err := ctxUser.GetRepositories(1, ctx.User.NumRepos); err != nil {
232 247
 			ctx.Handle(500, "GetRepositories", err)
233 248
 			return
234 249
 		}
235 250
 		repos = ctxUser.Repos
236
-	}
237 251
 
238
-	for _, repo := range repos {
239
-		if (isPullList && repo.NumPulls == 0) ||
240
-			(!isPullList &&
241
-				(!repo.EnableUnit(models.UnitTypeIssues) || repo.NumIssues == 0)) {
242
-			continue
252
+		for _, repo := range repos {
253
+			if (isPullList && repo.NumPulls == 0) ||
254
+				(!isPullList &&
255
+					(!repo.EnableUnit(models.UnitTypeIssues) || repo.NumIssues == 0)) {
256
+				continue
257
+			}
243 258
 		}
244
-
245
-		userRepoIDs = append(userRepoIDs, repo.ID)
246 259
 	}
247 260
 
248 261
 	var issues []*models.Issue