mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 08:30:25 +08:00 
			
		
		
		
	Fix TemplateRepo no longer in models.repo (#17993)
* Fixes error 500 that appears when trying to browse code of a repository generated from template * forgot to update comment * Update models/repo/repo.go Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> * Update repo.go Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
This commit is contained in:
		@@ -683,6 +683,16 @@ func getTemplateRepo(e db.Engine, repo *Repository) (*Repository, error) {
 | 
			
		||||
	return getRepositoryByID(e, repo.TemplateID)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// TemplateRepo returns the repository, which is template of this repository
 | 
			
		||||
func (repo *Repository) TemplateRepo() *Repository {
 | 
			
		||||
	repo, err := GetTemplateRepo(repo)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		log.Error("TemplateRepo: %v", err)
 | 
			
		||||
		return nil
 | 
			
		||||
	}
 | 
			
		||||
	return repo
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func countRepositories(userID int64, private bool) int64 {
 | 
			
		||||
	sess := db.GetEngine(db.DefaultContext).Where("id > 0")
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user