mirror of
https://github.com/go-gitea/gitea
synced 2025-08-23 01:48:27 +00:00
Add has_code
to repository REST API (#35214)
similar to how we can enable/disable repos or issues on a repo add the code unit as option to it. affects ``` PATCH /repos/{owner}/{repo} ``` --- *Sponsored by Kithara Software GmbH*
This commit is contained in:
@@ -869,6 +869,18 @@ func updateRepoUnits(ctx *context.APIContext, opts api.EditRepoOption) error {
|
||||
}
|
||||
}
|
||||
|
||||
if opts.HasCode != nil && !unit_model.TypeCode.UnitGlobalDisabled() {
|
||||
if *opts.HasCode {
|
||||
units = append(units, repo_model.RepoUnit{
|
||||
RepoID: repo.ID,
|
||||
Type: unit_model.TypeCode,
|
||||
Config: &repo_model.UnitConfig{},
|
||||
})
|
||||
} else {
|
||||
deleteUnitTypes = append(deleteUnitTypes, unit_model.TypeCode)
|
||||
}
|
||||
}
|
||||
|
||||
if opts.HasPullRequests != nil && !unit_model.TypePullRequests.UnitGlobalDisabled() {
|
||||
if *opts.HasPullRequests {
|
||||
// We do allow setting individual PR settings through the API, so
|
||||
|
Reference in New Issue
Block a user