]> source.dussan.org Git - gitea.git/commitdiff
#2162 completely disable builtin issue tracker when enable external tracker
authorUnknwon <u@gogs.io>
Thu, 4 Aug 2016 23:32:02 +0000 (16:32 -0700)
committerUnknwon <u@gogs.io>
Thu, 4 Aug 2016 23:32:02 +0000 (16:32 -0700)
README.md
cmd/web.go
gogs.go
routers/api/v1/api.go
routers/repo/issue.go
templates/.VERSION
templates/repo/header.tmpl

index 8dfd8c44d03e4776027206ed5f74e359afbf4048..ce80c414de8f6631077970805d52e7a24a59317f 100644 (file)
--- a/README.md
+++ b/README.md
@@ -3,7 +3,7 @@ Gogs - Go Git Service [![Build Status](https://travis-ci.org/gogits/gogs.svg?bra
 
 ![](https://github.com/gogits/gogs/blob/master/public/img/gogs-large-resize.png?raw=true)
 
-##### Current tip version: 0.9.60 (see [Releases](https://github.com/gogits/gogs/releases) for binary versions)
+##### Current tip version: 0.9.61 (see [Releases](https://github.com/gogits/gogs/releases) for binary versions)
 
 | Web | UI  | Preview  |
 |:-------------:|:-------:|:-------:|
index dfd0201305d02d5cc6bb6c3a46f97fa79696dd5e..39e297ee34a053d5d55ecb34021fb367673d288d 100644 (file)
@@ -449,7 +449,7 @@ func runWeb(ctx *cli.Context) error {
        m.Get("/:username/:reponame/action/:action", reqSignIn, context.RepoAssignment(), repo.Action)
        m.Group("/:username/:reponame", func() {
                m.Group("/issues", func() {
-                       m.Combo("/new", repo.MustEnableIssues).Get(context.RepoRef(), repo.NewIssue).
+                       m.Combo("/new").Get(context.RepoRef(), repo.NewIssue).
                                Post(bindIgnErr(auth.CreateIssueForm{}), repo.NewIssuePost)
 
                        m.Combo("/:index/comments").Post(bindIgnErr(auth.CreateCommentForm{}), repo.NewComment)
@@ -463,7 +463,7 @@ func runWeb(ctx *cli.Context) error {
                                m.Post("/title", repo.UpdateIssueTitle)
                                m.Post("/content", repo.UpdateIssueContent)
                        })
-               })
+               }, repo.MustEnableIssues)
                m.Group("/comments/:id", func() {
                        m.Post("", repo.UpdateCommentContent)
                        m.Post("/delete", repo.DeleteComment)
@@ -472,7 +472,7 @@ func runWeb(ctx *cli.Context) error {
                        m.Post("/new", bindIgnErr(auth.CreateLabelForm{}), repo.NewLabel)
                        m.Post("/edit", bindIgnErr(auth.CreateLabelForm{}), repo.UpdateLabel)
                        m.Post("/delete", repo.DeleteLabel)
-               }, reqRepoWriter, context.RepoRef())
+               }, repo.MustEnableIssues, reqRepoWriter, context.RepoRef())
                m.Group("/milestones", func() {
                        m.Combo("/new").Get(repo.NewMilestone).
                                Post(bindIgnErr(auth.CreateMilestoneForm{}), repo.NewMilestonePost)
@@ -480,7 +480,7 @@ func runWeb(ctx *cli.Context) error {
                        m.Post("/:id/edit", bindIgnErr(auth.CreateMilestoneForm{}), repo.EditMilestonePost)
                        m.Get("/:id/:action", repo.ChangeMilestonStatus)
                        m.Post("/delete", repo.DeleteMilestone)
-               }, reqRepoWriter, context.RepoRef())
+               }, repo.MustEnableIssues, reqRepoWriter, context.RepoRef())
 
                m.Group("/releases", func() {
                        m.Get("/new", repo.NewRelease)
diff --git a/gogs.go b/gogs.go
index 43579f7807c7fdd608e53e636c4a151a704dd538..6a6328db23fa9159956b0d9e501f8af9768e7457 100644 (file)
--- a/gogs.go
+++ b/gogs.go
@@ -17,7 +17,7 @@ import (
        "github.com/gogits/gogs/modules/setting"
 )
 
-const APP_VER = "0.9.60.0803"
+const APP_VER = "0.9.61.0804"
 
 func init() {
        runtime.GOMAXPROCS(runtime.NumCPU())
index e4398458f51fd5a7979d8d12bb5a6c79e4d889f1..d0d4914459911f8537ace69a9ab4101dcceb86ee 100644 (file)
@@ -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)
index 91d0c7b99e5595be37d9ffedeeb871a71634d370..3849da25d55672435533390e8b2e1559478a4def 100644 (file)
@@ -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
        }
index 3e31f4ddfc0eabf8a7c1230cabd30f0147ef27a4..f60bbf61775e1fb11c98020ff2b7806eb66d4531 100644 (file)
@@ -1 +1 @@
-0.9.60.0803
\ No newline at end of file
+0.9.61.0804
\ No newline at end of file
index d9ac29fbf96cd033436905c0cf730e8fdcce6e76..10bfb80e11e6b22e84ff13276675038793997253 100644 (file)
@@ -52,7 +52,7 @@
                        <a class="{{if .PageIsViewCode}}active{{end}} item" href="{{.RepoLink}}">
                                <i class="octicon octicon-code"></i> {{.i18n.Tr "repo.code"}}
                        </a>
-                       {{if .Repository.EnableIssues}}
+                       {{if and .Repository.EnableIssues (not .Repository.EnableExternalTracker)}}
                                <a class="{{if .PageIsIssueList}}active{{end}} item" href="{{.RepoLink}}/issues">
                                        <i class="octicon octicon-issue-opened"></i> {{.i18n.Tr "repo.issues"}} <span class="ui {{if not .Repository.NumOpenIssues}}gray{{else}}blue{{end}} small label">{{.Repository.NumOpenIssues}}</span>
                                </a>