aboutsummaryrefslogtreecommitdiffstats
path: root/routers
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2016-08-04 16:32:02 -0700
committerUnknwon <u@gogs.io>2016-08-04 16:32:02 -0700
commit2f105f397965637c46ca6c0092a7c5fe38440dab (patch)
tree0ddb0e4b25cbc7d28fbf6ec34fbfcc8514877481 /routers
parentee28fd92551961070cff4fe1b37ab94268c2f111 (diff)
downloadgitea-2f105f397965637c46ca6c0092a7c5fe38440dab.tar.gz
gitea-2f105f397965637c46ca6c0092a7c5fe38440dab.zip
#2162 completely disable builtin issue tracker when enable external tracker
Diffstat (limited to 'routers')
-rw-r--r--routers/api/v1/api.go9
-rw-r--r--routers/repo/issue.go2
2 files changed, 9 insertions, 2 deletions
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)
diff --git a/routers/repo/issue.go b/routers/repo/issue.go
index 91d0c7b99e..3849da25d5 100644
--- a/routers/repo/issue.go
+++ b/routers/repo/issue.go
@@ -52,7 +52,7 @@ var (
)
func MustEnableIssues(ctx *context.Context) {
- if !ctx.Repo.Repository.EnableIssues {
+ if !ctx.Repo.Repository.EnableIssues || ctx.Repo.Repository.EnableExternalTracker {
ctx.Handle(404, "MustEnableIssues", nil)
return
}