Skip to content

Commit bae9cbc

Browse files
Morlinestlunny
authored andcommitted
Remove redudant CheckUnit calls in router (#2627)
1 parent fbaa52a commit bae9cbc

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

routers/routes/routes.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,7 @@ func RegisterRoutes(m *macaron.Macaron) {
479479
// FIXME: should use different URLs but mostly same logic for comments of issue and pull reuqest.
480480
// So they can apply their own enable/disable logic on routers.
481481
m.Group("/issues", func() {
482-
m.Combo("/new", repo.MustEnableIssues).Get(context.RepoRef(), repo.NewIssue).
482+
m.Combo("/new").Get(context.RepoRef(), repo.NewIssue).
483483
Post(bindIgnErr(auth.CreateIssueForm{}), repo.NewIssuePost)
484484

485485
m.Group("/:index", func() {
@@ -606,12 +606,12 @@ func RegisterRoutes(m *macaron.Macaron) {
606606
Post(bindIgnErr(auth.NewWikiForm{}), repo.EditWikiPost)
607607
m.Post("/:page/delete", repo.DeleteWikiPagePost)
608608
}, reqSignIn, reqRepoWriter)
609-
}, repo.MustEnableWiki, context.RepoRef(), context.CheckUnit(models.UnitTypeWiki))
609+
}, repo.MustEnableWiki, context.RepoRef())
610610

611611
m.Group("/wiki", func() {
612612
m.Get("/raw/*", repo.WikiRaw)
613613
m.Get("/*", repo.WikiRaw)
614-
}, repo.MustEnableWiki, context.CheckUnit(models.UnitTypeWiki), context.CheckUnit(models.UnitTypeWiki))
614+
}, repo.MustEnableWiki)
615615

616616
m.Get("/archive/*", repo.MustBeNotBare, context.CheckUnit(models.UnitTypeCode), repo.Download)
617617

@@ -620,7 +620,7 @@ func RegisterRoutes(m *macaron.Macaron) {
620620
m.Get("/files", context.RepoRef(), repo.SetEditorconfigIfExists, repo.SetDiffViewStyle, repo.ViewPullFiles)
621621
m.Post("/merge", reqRepoWriter, repo.MergePullRequest)
622622
m.Post("/cleanup", context.RepoRef(), repo.CleanUpPullRequest)
623-
}, repo.MustAllowPulls, context.CheckUnit(models.UnitTypePullRequests))
623+
}, repo.MustAllowPulls)
624624

625625
m.Group("", func() {
626626
m.Get("/raw/*", repo.SingleDownload)

0 commit comments

Comments
 (0)