mirror of
				https://github.com/go-gitea/gitea
				synced 2025-11-03 21:08:25 +00:00 
			
		
		
		
	Enable/disable owner and repo projects independently (#28805)
Part of #23318 Add menu in repo settings to allow for repo admin to decide not just if projects are enabled or disabled per repo, but also which kind of projects (repo-level/owner-level) are enabled. If repo projects disabled, don't show the projects tab.  --------- Co-authored-by: delvh <dev.lh@web.de>
This commit is contained in:
		@@ -113,8 +113,11 @@ func innerToRepo(ctx context.Context, repo *repo_model.Repository, permissionInR
 | 
			
		||||
		defaultAllowMaintainerEdit = config.DefaultAllowMaintainerEdit
 | 
			
		||||
	}
 | 
			
		||||
	hasProjects := false
 | 
			
		||||
	if _, err := repo.GetUnit(ctx, unit_model.TypeProjects); err == nil {
 | 
			
		||||
	projectsMode := repo_model.ProjectsModeAll
 | 
			
		||||
	if unit, err := repo.GetUnit(ctx, unit_model.TypeProjects); err == nil {
 | 
			
		||||
		hasProjects = true
 | 
			
		||||
		config := unit.ProjectsConfig()
 | 
			
		||||
		projectsMode = config.ProjectsMode
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	hasReleases := false
 | 
			
		||||
@@ -211,6 +214,7 @@ func innerToRepo(ctx context.Context, repo *repo_model.Repository, permissionInR
 | 
			
		||||
		InternalTracker:               internalTracker,
 | 
			
		||||
		HasWiki:                       hasWiki,
 | 
			
		||||
		HasProjects:                   hasProjects,
 | 
			
		||||
		ProjectsMode:                  string(projectsMode),
 | 
			
		||||
		HasReleases:                   hasReleases,
 | 
			
		||||
		HasPackages:                   hasPackages,
 | 
			
		||||
		HasActions:                    hasActions,
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user