aboutsummaryrefslogtreecommitdiffstats
path: root/routers/api/v1/repo
diff options
context:
space:
mode:
Diffstat (limited to 'routers/api/v1/repo')
-rw-r--r--routers/api/v1/repo/repo.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/routers/api/v1/repo/repo.go b/routers/api/v1/repo/repo.go
index 93898cd7ef..5ebc7f251b 100644
--- a/routers/api/v1/repo/repo.go
+++ b/routers/api/v1/repo/repo.go
@@ -719,6 +719,17 @@ func updateRepoUnits(ctx *context.APIContext, opts api.EditRepoOption) error {
}
}
+ if opts.HasProjects != nil && !models.UnitTypeProjects.UnitGlobalDisabled() {
+ if *opts.HasProjects {
+ units = append(units, models.RepoUnit{
+ RepoID: repo.ID,
+ Type: models.UnitTypeProjects,
+ })
+ } else {
+ deleteUnitTypes = append(deleteUnitTypes, models.UnitTypeProjects)
+ }
+ }
+
if err := models.UpdateRepositoryUnits(repo, units, deleteUnitTypes); err != nil {
ctx.Error(http.StatusInternalServerError, "UpdateRepositoryUnits", err)
return err