Fix release counter on API repository info (#10968)

Use the same mechanism as the webpage for calculating the release count

Fix #10946
This commit is contained in:
6543 2020-04-06 20:42:30 +02:00 committed by GitHub
parent ef89e75d0e
commit ad31d6b5e8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 25 additions and 7 deletions

View file

@ -439,7 +439,7 @@ func RepoAssignment() macaron.Handler {
ctx.Data["RepoExternalIssuesLink"] = unit.ExternalTrackerConfig().ExternalTrackerURL
}
count, err := models.GetReleaseCountByRepoID(ctx.Repo.Repository.ID, models.FindReleasesOptions{
ctx.Data["NumReleases"], err = models.GetReleaseCountByRepoID(ctx.Repo.Repository.ID, models.FindReleasesOptions{
IncludeDrafts: false,
IncludeTags: true,
})
@ -447,7 +447,6 @@ func RepoAssignment() macaron.Handler {
ctx.ServerError("GetReleaseCountByRepoID", err)
return
}
ctx.Repo.Repository.NumReleases = int(count)
ctx.Data["Title"] = owner.Name + "/" + repo.Name
ctx.Data["Repository"] = repo