mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 08:30:25 +08:00 
			
		
		
		
	Require at least one unit to be enabled (#24189)
Don't remember why the previous decision that `Code` and `Release` are non-disable units globally. Since now every unit include `Code` could be disabled, maybe we should have a new rule that the repo should have at least one unit. So any unit could be disabled. Fixes #20960 Fixes #7525 --------- Co-authored-by: delvh <dev.lh@web.de> Co-authored-by: yp05327 <576951401@qq.com>
This commit is contained in:
		@@ -536,6 +536,12 @@ func SettingsPost(ctx *context.Context) {
 | 
			
		||||
			deleteUnitTypes = append(deleteUnitTypes, unit_model.TypePullRequests)
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if len(units) == 0 {
 | 
			
		||||
			ctx.Flash.Error(ctx.Tr("repo.settings.update_settings_no_unit"))
 | 
			
		||||
			ctx.Redirect(ctx.Repo.RepoLink + "/settings")
 | 
			
		||||
			return
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if err := repo_model.UpdateRepositoryUnits(repo, units, deleteUnitTypes); err != nil {
 | 
			
		||||
			ctx.ServerError("UpdateRepositoryUnits", err)
 | 
			
		||||
			return
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user