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 @@ -193,7 +193,7 @@ type Repository struct {
193193 NumMilestones int `xorm:"NOT NULL DEFAULT 0"`
194194 NumClosedMilestones int `xorm:"NOT NULL DEFAULT 0"`
195195 NumOpenMilestones int `xorm:"-"`
196- NumTags int `xorm:"-"`
196+ NumReleases int `xorm:"-"`
197197
198198 IsPrivate bool `xorm:"INDEX"`
199199 IsBare bool `xorm:"INDEX"`
Original file line number Diff line number Diff line change @@ -275,7 +275,15 @@ func RepoAssignment() macaron.Handler {
275275 return
276276 }
277277 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 )
279287
280288 ctx .Data ["Title" ] = owner .Name + "/" + repo .Name
281289 ctx .Data ["Repository" ] = repo
Original file line number Diff line number Diff line change 8181
8282 {{if and (.Repository.UnitEnabled $.UnitTypeReleases) (not .IsBareRepo) }}
8383 <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>
8585 </a>
8686 {{end}}
8787
You can’t perform that action at this time.
0 commit comments