aboutsummaryrefslogtreecommitdiffstats
path: root/routers
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2022-05-08 23:51:50 +0800
committerGitHub <noreply@github.com>2022-05-08 17:51:50 +0200
commitd4834071da9ce010fd4677ef339c598dd23dc130 (patch)
treeee6692b9b44e259d79158c2dc2b867d8f3286630 /routers
parent6a969681cd862bf153fa7921485278be1e8a092a (diff)
downloadgitea-d4834071da9ce010fd4677ef339c598dd23dc130.tar.gz
gitea-d4834071da9ce010fd4677ef339c598dd23dc130.zip
Repository level enable package or disable (#19323)
Diffstat (limited to 'routers')
-rw-r--r--routers/web/repo/setting.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/routers/web/repo/setting.go b/routers/web/repo/setting.go
index 09cb001772..ccb603833c 100644
--- a/routers/web/repo/setting.go
+++ b/routers/web/repo/setting.go
@@ -456,6 +456,15 @@ func SettingsPost(ctx *context.Context) {
deleteUnitTypes = append(deleteUnitTypes, unit_model.TypeProjects)
}
+ if form.EnablePackages && !unit_model.TypeProjects.UnitGlobalDisabled() {
+ units = append(units, repo_model.RepoUnit{
+ RepoID: repo.ID,
+ Type: unit_model.TypePackages,
+ })
+ } else if !unit_model.TypePackages.UnitGlobalDisabled() {
+ deleteUnitTypes = append(deleteUnitTypes, unit_model.TypePackages)
+ }
+
if form.EnablePulls && !unit_model.TypePullRequests.UnitGlobalDisabled() {
units = append(units, repo_model.RepoUnit{
RepoID: repo.ID,