File tree Expand file tree Collapse file tree 3 files changed +11
-3
lines changed Expand file tree Collapse file tree 3 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -194,7 +194,7 @@ type Repository struct {
194
194
NumMilestones int `xorm:"NOT NULL DEFAULT 0"`
195
195
NumClosedMilestones int `xorm:"NOT NULL DEFAULT 0"`
196
196
NumOpenMilestones int `xorm:"-"`
197
- NumTags int `xorm:"-"`
197
+ NumReleases int `xorm:"-"`
198
198
199
199
IsPrivate bool `xorm:"INDEX"`
200
200
IsBare bool `xorm:"INDEX"`
Original file line number Diff line number Diff line change @@ -275,7 +275,15 @@ func RepoAssignment() macaron.Handler {
275
275
return
276
276
}
277
277
ctx .Data ["Tags" ] = tags
278
- ctx .Repo .Repository .NumTags = len (tags )
278
+
279
+ count , err := models .GetReleaseCountByRepoID (ctx .Repo .Repository .ID , models.FindReleasesOptions {
280
+ IncludeDrafts : false ,
281
+ })
282
+ if err != nil {
283
+ ctx .Handle (500 , "GetReleaseCountByRepoID" , err )
284
+ return
285
+ }
286
+ ctx .Repo .Repository .NumReleases = int (count )
279
287
280
288
ctx .Data ["Title" ] = owner .Name + "/" + repo .Name
281
289
ctx .Data ["Repository" ] = repo
Original file line number Diff line number Diff line change 81
81
82
82
{{if and (.Repository.UnitEnabled $.UnitTypeReleases) (not .IsBareRepo) }}
83
83
<a class="{{if .PageIsReleaseList}}active{{end}} item" href="{{.RepoLink}}/releases">
84
- <i class="octicon octicon-tag"></i> {{.i18n.Tr "repo.releases"}} <span class="ui {{if not .Repository.NumTags }}gray{{else}}blue{{end}} small label">{{.Repository.NumTags }}</span>
84
+ <i class="octicon octicon-tag"></i> {{.i18n.Tr "repo.releases"}} <span class="ui {{if not .Repository.NumReleases }}gray{{else}}blue{{end}} small label">{{.Repository.NumReleases }}</span>
85
85
</a>
86
86
{{end}}
87
87
You can’t perform that action at this time.
0 commit comments