@@ -175,11 +175,12 @@ func Milestones(ctx *context.Context) {
175175
176176 var (
177177 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
183184 }
184185
185186 userRepoCond = models .SearchRepositoryCondition (& repoOpts ) // all repo condition user could visit
@@ -232,16 +233,15 @@ func Milestones(ctx *context.Context) {
232233 return
233234 }
234235
235- showRepos , _ , err := models .SearchRepositoryByCondition (& repoOpts , userRepoCond , false )
236+ userRepos , _ , err := models .SearchRepositoryByCondition (& repoOpts , userRepoCond , false )
236237 if err != nil {
237238 ctx .ServerError ("SearchRepositoryByCondition" , err )
238239 return
239240 }
240241
241- sort .Sort (showRepos )
242-
242+ var showRepos = userRepos /*make(models.RepositoryList, 0, len(userRepos))*/
243243 for i := 0 ; i < len (milestones ); {
244- for _ , repo := range showRepos {
244+ for _ , repo := range userRepos {
245245 if milestones [i ].RepoID == repo .ID {
246246 milestones [i ].Repo = repo
247247 break
@@ -253,6 +253,17 @@ func Milestones(ctx *context.Context) {
253253 continue
254254 }
255255
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+
256267 milestones [i ].RenderedContent = string (markdown .Render ([]byte (milestones [i ].Content ), milestones [i ].Repo .Link (), milestones [i ].Repo .ComposeMetas ()))
257268 if milestones [i ].Repo .IsTimetrackerEnabled () {
258269 err := milestones [i ].LoadTotalTrackedTime ()
@@ -264,6 +275,8 @@ func Milestones(ctx *context.Context) {
264275 i ++
265276 }
266277
278+ sort .Sort (showRepos )
279+
267280 milestoneStats , err := models .GetMilestonesStats (repoCond )
268281 if err != nil {
269282 ctx .ServerError ("GetMilestoneStats" , err )
0 commit comments