diff options
author | David Svantesson <davidsvantesson@gmail.com> | 2020-01-17 08:34:37 +0100 |
---|---|---|
committer | Lauris BH <lauris@nix.lv> | 2020-01-17 09:34:37 +0200 |
commit | 3c07d03c0388d3b86138572401281b51f2db9282 (patch) | |
tree | 06eecf8b818ee8721a5dbfdd688eb5f45e5bef51 /routers/user/home.go | |
parent | 36943e56d66a2d711a6b0c27219ce91a3ddc020a (diff) | |
download | gitea-3c07d03c0388d3b86138572401281b51f2db9282.tar.gz gitea-3c07d03c0388d3b86138572401281b51f2db9282.zip |
Add setting to set default and global disabled repository units. (#8788)
* Add possibility to global disable repo units.
* Add Default Repo Unit app.ini setting.
* Hide units
* Hide disabled repo units
* Minor fixes
* Indicate disabled units in team settings.
Co-authored-by: Lauris BH <lauris@nix.lv>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: zeripath <art27@cantab.net>
Diffstat (limited to 'routers/user/home.go')
-rw-r--r-- | routers/user/home.go | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/routers/user/home.go b/routers/user/home.go index 822452f1ca..0d78b17dad 100644 --- a/routers/user/home.go +++ b/routers/user/home.go @@ -158,6 +158,12 @@ func Dashboard(ctx *context.Context) { // Milestones render the user milestones page func Milestones(ctx *context.Context) { + if models.UnitTypeIssues.UnitGlobalDisabled() && models.UnitTypePullRequests.UnitGlobalDisabled() { + log.Debug("Milestones overview page not available as both issues and pull requests are globally disabled") + ctx.Status(404) + return + } + ctx.Data["Title"] = ctx.Tr("milestones") ctx.Data["PageIsMilestonesDashboard"] = true @@ -335,10 +341,22 @@ func Issues(ctx *context.Context) { isPullList := ctx.Params(":type") == "pulls" unitType := models.UnitTypeIssues if isPullList { + if models.UnitTypePullRequests.UnitGlobalDisabled() { + log.Debug("Pull request overview page not available as it is globally disabled.") + ctx.Status(404) + return + } + ctx.Data["Title"] = ctx.Tr("pull_requests") ctx.Data["PageIsPulls"] = true unitType = models.UnitTypePullRequests } else { + if models.UnitTypeIssues.UnitGlobalDisabled() { + log.Debug("Issues overview page not available as it is globally disabled.") + ctx.Status(404) + return + } + ctx.Data["Title"] = ctx.Tr("issues") ctx.Data["PageIsIssues"] = true } |