diff options
author | Lauris BH <lauris@nix.lv> | 2017-08-28 17:06:10 +0300 |
---|---|---|
committer | Lunny Xiao <xiaolunwen@gmail.com> | 2017-08-28 22:06:10 +0800 |
commit | edb95faba2534d9bf53068b69db99ffa7b71938f (patch) | |
tree | 56a9ffb83c1bffe1da1d7a307363d9500ac08d13 /modules/context | |
parent | d23b36c598cd30f2da7446ef20154f6172ae8795 (diff) | |
download | gitea-edb95faba2534d9bf53068b69db99ffa7b71938f.tar.gz gitea-edb95faba2534d9bf53068b69db99ffa7b71938f.zip |
Fix releases to be counted from database not tags (#2389)
Diffstat (limited to 'modules/context')
-rw-r--r-- | modules/context/repo.go | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/modules/context/repo.go b/modules/context/repo.go index db643b50b8..b16d188428 100644 --- a/modules/context/repo.go +++ b/modules/context/repo.go @@ -275,7 +275,15 @@ func RepoAssignment() macaron.Handler { return } ctx.Data["Tags"] = tags - ctx.Repo.Repository.NumTags = len(tags) + + count, err := models.GetReleaseCountByRepoID(ctx.Repo.Repository.ID, models.FindReleasesOptions{ + IncludeDrafts: false, + }) + if err != nil { + ctx.Handle(500, "GetReleaseCountByRepoID", err) + return + } + ctx.Repo.Repository.NumReleases = int(count) ctx.Data["Title"] = owner.Name + "/" + repo.Name ctx.Data["Repository"] = repo |