diff --git a/models/unit.go b/models/unit.go index a14edcec0..db15100c5 100644 --- a/models/unit.go +++ b/models/unit.go @@ -16,6 +16,7 @@ const ( UnitTypeWiki // 5 Wiki UnitTypeExternalWiki // 6 ExternalWiki UnitTypeExternalTracker // 7 ExternalTracker + UnitTypeIssueDependencies // 8 Issue Dependencies ) var ( @@ -28,6 +29,7 @@ var ( UnitTypeWiki, UnitTypeExternalWiki, UnitTypeExternalTracker, + UnitTypeIssueDependencies, } // defaultRepoUnits contains the default unit types diff --git a/modules/auth/repo_form.go b/modules/auth/repo_form.go index a6454655f..a226f69a3 100644 --- a/modules/auth/repo_form.go +++ b/modules/auth/repo_form.go @@ -106,6 +106,7 @@ type RepoSettingForm struct { EnablePulls bool EnableTimetracker bool AllowOnlyContributorsToTrackTime bool + EnableIssueDependencies bool } // Validate validates the fields diff --git a/routers/repo/setting.go b/routers/repo/setting.go index eb4136b07..27fb751f8 100644 --- a/routers/repo/setting.go +++ b/routers/repo/setting.go @@ -16,6 +16,7 @@ import ( "code.gitea.io/gitea/modules/context" "code.gitea.io/gitea/modules/log" "code.gitea.io/gitea/modules/setting" + "fmt" ) const ( @@ -219,6 +220,15 @@ func SettingsPost(ctx *context.Context, form auth.RepoSettingForm) { }) } + if form.EnableIssueDependencies{ + units = append(units, models.RepoUnit{ + RepoID: repo.ID, + Type: models.UnitTypeIssueDependencies, + Index: int(models.UnitTypeIssueDependencies), + Config: new(models.UnitConfig), + }) + } + if err := models.UpdateRepositoryUnits(repo, units); err != nil { ctx.Handle(500, "UpdateRepositoryUnits", err) return diff --git a/templates/repo/settings/options.tmpl b/templates/repo/settings/options.tmpl index b2b7fc9c3..ec3b8f693 100644 --- a/templates/repo/settings/options.tmpl +++ b/templates/repo/settings/options.tmpl @@ -153,6 +153,12 @@ +