mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 16:40:24 +08:00 
			
		
		
		
	Better repo API unit checks (#21130)
This PR would presumably Fix #20522 Fix #18773 Fix #19069 Fix #21077 Fix #13622 ----- 1. Check whether unit type is currently enabled 2. Check if it _will_ be enabled via opt 3. Allow modification as necessary Signed-off-by: jolheiser <john.olheiser@gmail.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: 6543 <6543@obermui.de>
This commit is contained in:
		@@ -151,13 +151,13 @@ type EditRepoOption struct {
 | 
			
		||||
	Template *bool `json:"template,omitempty"`
 | 
			
		||||
	// either `true` to enable issues for this repository or `false` to disable them.
 | 
			
		||||
	HasIssues *bool `json:"has_issues,omitempty"`
 | 
			
		||||
	// set this structure to configure internal issue tracker (requires has_issues)
 | 
			
		||||
	// set this structure to configure internal issue tracker
 | 
			
		||||
	InternalTracker *InternalTracker `json:"internal_tracker,omitempty"`
 | 
			
		||||
	// set this structure to use external issue tracker (requires has_issues)
 | 
			
		||||
	// set this structure to use external issue tracker
 | 
			
		||||
	ExternalTracker *ExternalTracker `json:"external_tracker,omitempty"`
 | 
			
		||||
	// either `true` to enable the wiki for this repository or `false` to disable it.
 | 
			
		||||
	HasWiki *bool `json:"has_wiki,omitempty"`
 | 
			
		||||
	// set this structure to use external wiki instead of internal (requires has_wiki)
 | 
			
		||||
	// set this structure to use external wiki instead of internal
 | 
			
		||||
	ExternalWiki *ExternalWiki `json:"external_wiki,omitempty"`
 | 
			
		||||
	// sets the default branch for this repository.
 | 
			
		||||
	DefaultBranch *string `json:"default_branch,omitempty"`
 | 
			
		||||
@@ -165,25 +165,25 @@ type EditRepoOption struct {
 | 
			
		||||
	HasPullRequests *bool `json:"has_pull_requests,omitempty"`
 | 
			
		||||
	// either `true` to enable project unit, or `false` to disable them.
 | 
			
		||||
	HasProjects *bool `json:"has_projects,omitempty"`
 | 
			
		||||
	// either `true` to ignore whitespace for conflicts, or `false` to not ignore whitespace. `has_pull_requests` must be `true`.
 | 
			
		||||
	// either `true` to ignore whitespace for conflicts, or `false` to not ignore whitespace.
 | 
			
		||||
	IgnoreWhitespaceConflicts *bool `json:"ignore_whitespace_conflicts,omitempty"`
 | 
			
		||||
	// either `true` to allow merging pull requests with a merge commit, or `false` to prevent merging pull requests with merge commits. `has_pull_requests` must be `true`.
 | 
			
		||||
	// either `true` to allow merging pull requests with a merge commit, or `false` to prevent merging pull requests with merge commits.
 | 
			
		||||
	AllowMerge *bool `json:"allow_merge_commits,omitempty"`
 | 
			
		||||
	// either `true` to allow rebase-merging pull requests, or `false` to prevent rebase-merging. `has_pull_requests` must be `true`.
 | 
			
		||||
	// either `true` to allow rebase-merging pull requests, or `false` to prevent rebase-merging.
 | 
			
		||||
	AllowRebase *bool `json:"allow_rebase,omitempty"`
 | 
			
		||||
	// either `true` to allow rebase with explicit merge commits (--no-ff), or `false` to prevent rebase with explicit merge commits. `has_pull_requests` must be `true`.
 | 
			
		||||
	// either `true` to allow rebase with explicit merge commits (--no-ff), or `false` to prevent rebase with explicit merge commits.
 | 
			
		||||
	AllowRebaseMerge *bool `json:"allow_rebase_explicit,omitempty"`
 | 
			
		||||
	// either `true` to allow squash-merging pull requests, or `false` to prevent squash-merging. `has_pull_requests` must be `true`.
 | 
			
		||||
	// either `true` to allow squash-merging pull requests, or `false` to prevent squash-merging.
 | 
			
		||||
	AllowSquash *bool `json:"allow_squash_merge,omitempty"`
 | 
			
		||||
	// either `true` to allow mark pr as merged manually, or `false` to prevent it. `has_pull_requests` must be `true`.
 | 
			
		||||
	// either `true` to allow mark pr as merged manually, or `false` to prevent it.
 | 
			
		||||
	AllowManualMerge *bool `json:"allow_manual_merge,omitempty"`
 | 
			
		||||
	// either `true` to enable AutodetectManualMerge, or `false` to prevent it. `has_pull_requests` must be `true`, Note: In some special cases, misjudgments can occur.
 | 
			
		||||
	// either `true` to enable AutodetectManualMerge, or `false` to prevent it. Note: In some special cases, misjudgments can occur.
 | 
			
		||||
	AutodetectManualMerge *bool `json:"autodetect_manual_merge,omitempty"`
 | 
			
		||||
	// either `true` to allow updating pull request branch by rebase, or `false` to prevent it. `has_pull_requests` must be `true`.
 | 
			
		||||
	// either `true` to allow updating pull request branch by rebase, or `false` to prevent it.
 | 
			
		||||
	AllowRebaseUpdate *bool `json:"allow_rebase_update,omitempty"`
 | 
			
		||||
	// set to `true` to delete pr branch after merge by default
 | 
			
		||||
	DefaultDeleteBranchAfterMerge *bool `json:"default_delete_branch_after_merge,omitempty"`
 | 
			
		||||
	// set to a merge style to be used by this repository: "merge", "rebase", "rebase-merge", or "squash". `has_pull_requests` must be `true`.
 | 
			
		||||
	// set to a merge style to be used by this repository: "merge", "rebase", "rebase-merge", or "squash".
 | 
			
		||||
	DefaultMergeStyle *string `json:"default_merge_style,omitempty"`
 | 
			
		||||
	// set to `true` to archive this repository.
 | 
			
		||||
	Archived *bool `json:"archived,omitempty"`
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user