mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-10-26 12:27:06 +00:00 
			
		
		
		
	Fix releases to be counted from database not tags (#2389)
This commit is contained in:
		| @@ -194,7 +194,7 @@ type Repository struct { | |||||||
| 	NumMilestones       int `xorm:"NOT NULL DEFAULT 0"` | 	NumMilestones       int `xorm:"NOT NULL DEFAULT 0"` | ||||||
| 	NumClosedMilestones int `xorm:"NOT NULL DEFAULT 0"` | 	NumClosedMilestones int `xorm:"NOT NULL DEFAULT 0"` | ||||||
| 	NumOpenMilestones   int `xorm:"-"` | 	NumOpenMilestones   int `xorm:"-"` | ||||||
| 	NumTags             int `xorm:"-"` | 	NumReleases         int `xorm:"-"` | ||||||
|  |  | ||||||
| 	IsPrivate bool `xorm:"INDEX"` | 	IsPrivate bool `xorm:"INDEX"` | ||||||
| 	IsBare    bool `xorm:"INDEX"` | 	IsBare    bool `xorm:"INDEX"` | ||||||
|   | |||||||
| @@ -275,7 +275,15 @@ func RepoAssignment() macaron.Handler { | |||||||
| 			return | 			return | ||||||
| 		} | 		} | ||||||
| 		ctx.Data["Tags"] = tags | 		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["Title"] = owner.Name + "/" + repo.Name | ||||||
| 		ctx.Data["Repository"] = repo | 		ctx.Data["Repository"] = repo | ||||||
|   | |||||||
| @@ -81,7 +81,7 @@ | |||||||
|  |  | ||||||
| 			{{if and (.Repository.UnitEnabled $.UnitTypeReleases) (not .IsBareRepo) }} | 			{{if and (.Repository.UnitEnabled $.UnitTypeReleases) (not .IsBareRepo) }} | ||||||
| 			<a class="{{if .PageIsReleaseList}}active{{end}} item" href="{{.RepoLink}}/releases"> | 			<a class="{{if .PageIsReleaseList}}active{{end}} item" href="{{.RepoLink}}/releases"> | ||||||
| 				<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> | 				<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> | ||||||
| 			</a> | 			</a> | ||||||
| 			{{end}} | 			{{end}} | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Lauris BH
					Lauris BH