Skip to content

Commit 9c645b5

Browse files
lunnybkcsoft
authored andcommitted
bug fixed on issues and pulls
1 parent cf47532 commit 9c645b5

File tree

2 files changed

+21
-9
lines changed

2 files changed

+21
-9
lines changed

models/org.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -657,7 +657,6 @@ func (env *accessibleReposEnv) Repos(page, pageSize int) ([]*Repository, error)
657657
}
658658

659659
repos := make([]*Repository, 0, len(repoIDs))
660-
661660
if len(repoIDs) <= 0 {
662661
return repos, nil
663662
}

routers/user/home.go

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -227,22 +227,35 @@ func Issues(ctx *context.Context) {
227227
ctx.Handle(500, "GetRepositories", err)
228228
return
229229
}
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+
230245
} else {
231246
if err := ctxUser.GetRepositories(1, ctx.User.NumRepos); err != nil {
232247
ctx.Handle(500, "GetRepositories", err)
233248
return
234249
}
235250
repos = ctxUser.Repos
236-
}
237251

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+
}
243258
}
244-
245-
userRepoIDs = append(userRepoIDs, repo.ID)
246259
}
247260

248261
var issues []*models.Issue

0 commit comments

Comments
 (0)