mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-10-31 05:24:50 +00:00 
			
		
		
		
	#2162 completely disable builtin issue tracker when enable external tracker
This commit is contained in:
		| @@ -3,7 +3,7 @@ Gogs - Go Git Service [ |  | ||||||
|  |  | ||||||
| ##### 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  | | | Web | UI  | Preview  | | ||||||
| |:-------------:|:-------:|:-------:| | |:-------------:|:-------:|:-------:| | ||||||
|   | |||||||
| @@ -449,7 +449,7 @@ func runWeb(ctx *cli.Context) error { | |||||||
| 	m.Get("/:username/:reponame/action/:action", reqSignIn, context.RepoAssignment(), repo.Action) | 	m.Get("/:username/:reponame/action/:action", reqSignIn, context.RepoAssignment(), repo.Action) | ||||||
| 	m.Group("/:username/:reponame", func() { | 	m.Group("/:username/:reponame", func() { | ||||||
| 		m.Group("/issues", 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) | 				Post(bindIgnErr(auth.CreateIssueForm{}), repo.NewIssuePost) | ||||||
|  |  | ||||||
| 			m.Combo("/:index/comments").Post(bindIgnErr(auth.CreateCommentForm{}), repo.NewComment) | 			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("/title", repo.UpdateIssueTitle) | ||||||
| 				m.Post("/content", repo.UpdateIssueContent) | 				m.Post("/content", repo.UpdateIssueContent) | ||||||
| 			}) | 			}) | ||||||
| 		}) | 		}, repo.MustEnableIssues) | ||||||
| 		m.Group("/comments/:id", func() { | 		m.Group("/comments/:id", func() { | ||||||
| 			m.Post("", repo.UpdateCommentContent) | 			m.Post("", repo.UpdateCommentContent) | ||||||
| 			m.Post("/delete", repo.DeleteComment) | 			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("/new", bindIgnErr(auth.CreateLabelForm{}), repo.NewLabel) | ||||||
| 			m.Post("/edit", bindIgnErr(auth.CreateLabelForm{}), repo.UpdateLabel) | 			m.Post("/edit", bindIgnErr(auth.CreateLabelForm{}), repo.UpdateLabel) | ||||||
| 			m.Post("/delete", repo.DeleteLabel) | 			m.Post("/delete", repo.DeleteLabel) | ||||||
| 		}, reqRepoWriter, context.RepoRef()) | 		}, repo.MustEnableIssues, reqRepoWriter, context.RepoRef()) | ||||||
| 		m.Group("/milestones", func() { | 		m.Group("/milestones", func() { | ||||||
| 			m.Combo("/new").Get(repo.NewMilestone). | 			m.Combo("/new").Get(repo.NewMilestone). | ||||||
| 				Post(bindIgnErr(auth.CreateMilestoneForm{}), repo.NewMilestonePost) | 				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.Post("/:id/edit", bindIgnErr(auth.CreateMilestoneForm{}), repo.EditMilestonePost) | ||||||
| 			m.Get("/:id/:action", repo.ChangeMilestonStatus) | 			m.Get("/:id/:action", repo.ChangeMilestonStatus) | ||||||
| 			m.Post("/delete", repo.DeleteMilestone) | 			m.Post("/delete", repo.DeleteMilestone) | ||||||
| 		}, reqRepoWriter, context.RepoRef()) | 		}, repo.MustEnableIssues, reqRepoWriter, context.RepoRef()) | ||||||
|  |  | ||||||
| 		m.Group("/releases", func() { | 		m.Group("/releases", func() { | ||||||
| 			m.Get("/new", repo.NewRelease) | 			m.Get("/new", repo.NewRelease) | ||||||
|   | |||||||
							
								
								
									
										2
									
								
								gogs.go
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								gogs.go
									
									
									
									
									
								
							| @@ -17,7 +17,7 @@ import ( | |||||||
| 	"github.com/gogits/gogs/modules/setting" | 	"github.com/gogits/gogs/modules/setting" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| const APP_VER = "0.9.60.0803" | const APP_VER = "0.9.61.0804" | ||||||
|  |  | ||||||
| func init() { | func init() { | ||||||
| 	runtime.GOMAXPROCS(runtime.NumCPU()) | 	runtime.GOMAXPROCS(runtime.NumCPU()) | ||||||
|   | |||||||
| @@ -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. | // RegisterRoutes registers all v1 APIs routes to web application. | ||||||
| // FIXME: custom form error response | // FIXME: custom form error response | ||||||
| func RegisterRoutes(m *macaron.Macaron) { | func RegisterRoutes(m *macaron.Macaron) { | ||||||
| @@ -252,7 +259,7 @@ func RegisterRoutes(m *macaron.Macaron) { | |||||||
| 						}) | 						}) | ||||||
|  |  | ||||||
| 					}) | 					}) | ||||||
| 				}) | 				}, MustEnableIssues) | ||||||
| 				m.Group("/labels", func() { | 				m.Group("/labels", func() { | ||||||
| 					m.Combo("").Get(repo.ListLabels). | 					m.Combo("").Get(repo.ListLabels). | ||||||
| 						Post(bind(api.CreateLabelOption{}), repo.CreateLabel) | 						Post(bind(api.CreateLabelOption{}), repo.CreateLabel) | ||||||
|   | |||||||
| @@ -52,7 +52,7 @@ var ( | |||||||
| ) | ) | ||||||
|  |  | ||||||
| func MustEnableIssues(ctx *context.Context) { | func MustEnableIssues(ctx *context.Context) { | ||||||
| 	if !ctx.Repo.Repository.EnableIssues { | 	if !ctx.Repo.Repository.EnableIssues || ctx.Repo.Repository.EnableExternalTracker { | ||||||
| 		ctx.Handle(404, "MustEnableIssues", nil) | 		ctx.Handle(404, "MustEnableIssues", nil) | ||||||
| 		return | 		return | ||||||
| 	} | 	} | ||||||
|   | |||||||
| @@ -1 +1 @@ | |||||||
| 0.9.60.0803 | 0.9.61.0804 | ||||||
| @@ -52,7 +52,7 @@ | |||||||
| 			<a class="{{if .PageIsViewCode}}active{{end}} item" href="{{.RepoLink}}"> | 			<a class="{{if .PageIsViewCode}}active{{end}} item" href="{{.RepoLink}}"> | ||||||
| 				<i class="octicon octicon-code"></i> {{.i18n.Tr "repo.code"}} | 				<i class="octicon octicon-code"></i> {{.i18n.Tr "repo.code"}} | ||||||
| 			</a> | 			</a> | ||||||
| 			{{if .Repository.EnableIssues}} | 			{{if and .Repository.EnableIssues (not .Repository.EnableExternalTracker)}} | ||||||
| 				<a class="{{if .PageIsIssueList}}active{{end}} item" href="{{.RepoLink}}/issues"> | 				<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> | 					<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> | 				</a> | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user