From 3c07d03c0388d3b86138572401281b51f2db9282 Mon Sep 17 00:00:00 2001 From: David Svantesson Date: Fri, 17 Jan 2020 08:34:37 +0100 Subject: 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 Co-authored-by: Lunny Xiao Co-authored-by: zeripath --- routers/user/home.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'routers/user') 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 } -- cgit v1.2.3