@@ -175,11 +175,12 @@ func Milestones(ctx *context.Context) {
175
175
176
176
var (
177
177
repoOpts = models.SearchRepoOptions {
178
- Actor : ctxUser ,
179
- OwnerID : ctxUser .ID ,
180
- Private : true ,
181
- AllPublic : false , // Include also all public repositories of users and public organisations
182
- AllLimited : false , // Include also all public repositories of limited organisations
178
+ Actor : ctxUser ,
179
+ OwnerID : ctxUser .ID ,
180
+ Private : true ,
181
+ AllPublic : false , // Include also all public repositories of users and public organisations
182
+ AllLimited : false , // Include also all public repositories of limited organisations
183
+ HasMilestones : util .OptionalBoolTrue , // Just needs display repos has milestones
183
184
}
184
185
185
186
userRepoCond = models .SearchRepositoryCondition (& repoOpts ) // all repo condition user could visit
@@ -232,16 +233,15 @@ func Milestones(ctx *context.Context) {
232
233
return
233
234
}
234
235
235
- showRepos , _ , err := models .SearchRepositoryByCondition (& repoOpts , userRepoCond , false )
236
+ userRepos , _ , err := models .SearchRepositoryByCondition (& repoOpts , userRepoCond , false )
236
237
if err != nil {
237
238
ctx .ServerError ("SearchRepositoryByCondition" , err )
238
239
return
239
240
}
240
241
241
- sort .Sort (showRepos )
242
-
242
+ var showRepos = userRepos /*make(models.RepositoryList, 0, len(userRepos))*/
243
243
for i := 0 ; i < len (milestones ); {
244
- for _ , repo := range showRepos {
244
+ for _ , repo := range userRepos {
245
245
if milestones [i ].RepoID == repo .ID {
246
246
milestones [i ].Repo = repo
247
247
break
@@ -253,6 +253,17 @@ func Milestones(ctx *context.Context) {
253
253
continue
254
254
}
255
255
256
+ /*var found bool
257
+ for _, repo := range showRepos {
258
+ if milestones[i].Repo.ID == repo.ID {
259
+ found = true
260
+ break
261
+ }
262
+ }
263
+ if !found {
264
+ showRepos = append(showRepos, milestones[i].Repo)
265
+ }*/
266
+
256
267
milestones [i ].RenderedContent = string (markdown .Render ([]byte (milestones [i ].Content ), milestones [i ].Repo .Link (), milestones [i ].Repo .ComposeMetas ()))
257
268
if milestones [i ].Repo .IsTimetrackerEnabled () {
258
269
err := milestones [i ].LoadTotalTrackedTime ()
@@ -264,6 +275,8 @@ func Milestones(ctx *context.Context) {
264
275
i ++
265
276
}
266
277
278
+ sort .Sort (showRepos )
279
+
267
280
milestoneStats , err := models .GetMilestonesStats (repoCond )
268
281
if err != nil {
269
282
ctx .ServerError ("GetMilestoneStats" , err )
0 commit comments