Add repository setting to enable/disable releases unit (#22671)

To go along with similar settings for issues, pulls, projects, packages.
This commit is contained in:
Brecht Van Lommel
2023-02-01 02:31:19 +01:00
committed by GitHub
parent b6145bfaa3
commit faa96553d1
4 changed files with 24 additions and 0 deletions

View File

@ -488,6 +488,15 @@ func SettingsPost(ctx *context.Context) {
deleteUnitTypes = append(deleteUnitTypes, unit_model.TypeProjects)
}
if form.EnableReleases && !unit_model.TypeReleases.UnitGlobalDisabled() {
units = append(units, repo_model.RepoUnit{
RepoID: repo.ID,
Type: unit_model.TypeReleases,
})
} else if !unit_model.TypeReleases.UnitGlobalDisabled() {
deleteUnitTypes = append(deleteUnitTypes, unit_model.TypeReleases)
}
if form.EnablePackages && !unit_model.TypePackages.UnitGlobalDisabled() {
units = append(units, repo_model.RepoUnit{
RepoID: repo.ID,