From 2f105f397965637c46ca6c0092a7c5fe38440dab Mon Sep 17 00:00:00 2001 From: Unknwon Date: Thu, 4 Aug 2016 16:32:02 -0700 Subject: #2162 completely disable builtin issue tracker when enable external tracker --- routers/api/v1/api.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'routers/api/v1') diff --git a/routers/api/v1/api.go b/routers/api/v1/api.go index e4398458f5..d0d4914459 100644 --- a/routers/api/v1/api.go +++ b/routers/api/v1/api.go @@ -151,6 +151,13 @@ func OrgAssignment(args ...bool) macaron.Handler { } } +func MustEnableIssues(ctx *context.APIContext) { + if !ctx.Repo.Repository.EnableIssues || ctx.Repo.Repository.EnableExternalTracker { + ctx.Status(404) + return + } +} + // RegisterRoutes registers all v1 APIs routes to web application. // FIXME: custom form error response func RegisterRoutes(m *macaron.Macaron) { @@ -252,7 +259,7 @@ func RegisterRoutes(m *macaron.Macaron) { }) }) - }) + }, MustEnableIssues) m.Group("/labels", func() { m.Combo("").Get(repo.ListLabels). Post(bind(api.CreateLabelOption{}), repo.CreateLabel) -- cgit v1.2.3