Rename MustEnablePulls() to MustAllowPulls() and simplify the contained check to AllowsPulls().
parent
a467184e13
commit
a1b28fc33c
|
@ -470,7 +470,7 @@ func runWeb(ctx *cli.Context) {
|
||||||
m.Post("/delete", repo.DeleteRelease)
|
m.Post("/delete", repo.DeleteRelease)
|
||||||
}, reqRepoAdmin, middleware.RepoRef())
|
}, reqRepoAdmin, middleware.RepoRef())
|
||||||
|
|
||||||
m.Combo("/compare/*", repo.MustEnablePulls).Get(repo.CompareAndPullRequest).
|
m.Combo("/compare/*", repo.MustAllowPulls).Get(repo.CompareAndPullRequest).
|
||||||
Post(bindIgnErr(auth.CreateIssueForm{}), repo.CompareAndPullRequestPost)
|
Post(bindIgnErr(auth.CreateIssueForm{}), repo.CompareAndPullRequestPost)
|
||||||
}, reqSignIn, middleware.RepoAssignment(), repo.MustBeNotBare)
|
}, reqSignIn, middleware.RepoAssignment(), repo.MustBeNotBare)
|
||||||
|
|
||||||
|
@ -503,7 +503,7 @@ func runWeb(ctx *cli.Context) {
|
||||||
m.Get("/commits", middleware.RepoRef(), repo.ViewPullCommits)
|
m.Get("/commits", middleware.RepoRef(), repo.ViewPullCommits)
|
||||||
m.Get("/files", middleware.RepoRef(), repo.ViewPullFiles)
|
m.Get("/files", middleware.RepoRef(), repo.ViewPullFiles)
|
||||||
m.Post("/merge", reqRepoAdmin, repo.MergePullRequest)
|
m.Post("/merge", reqRepoAdmin, repo.MergePullRequest)
|
||||||
}, repo.MustEnablePulls)
|
}, repo.MustAllowPulls)
|
||||||
|
|
||||||
m.Group("", func() {
|
m.Group("", func() {
|
||||||
m.Get("/src/*", repo.Home)
|
m.Get("/src/*", repo.Home)
|
||||||
|
|
|
@ -47,11 +47,9 @@ func MustEnableIssues(ctx *middleware.Context) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func MustEnablePulls(ctx *middleware.Context) {
|
func MustAllowPulls(ctx *middleware.Context) {
|
||||||
if !ctx.Repo.Repository.CanEnablePulls() {
|
if !ctx.Repo.Repository.AllowsPulls() {
|
||||||
ctx.Handle(404, "Unsupported", nil)
|
ctx.Handle(404, "MustAllowPulls", nil)
|
||||||
} else if !ctx.Repo.Repository.EnablePulls {
|
|
||||||
ctx.Handle(404, "MustEnablePulls", nil)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.Data["HasForkedRepo"] = ctx.IsSigned && ctx.User.HasForkedRepo(ctx.Repo.Repository.ID)
|
ctx.Data["HasForkedRepo"] = ctx.IsSigned && ctx.User.HasForkedRepo(ctx.Repo.Repository.ID)
|
||||||
|
@ -73,7 +71,7 @@ func RetrieveLabels(ctx *middleware.Context) {
|
||||||
func Issues(ctx *middleware.Context) {
|
func Issues(ctx *middleware.Context) {
|
||||||
isPullList := ctx.Params(":type") == "pulls"
|
isPullList := ctx.Params(":type") == "pulls"
|
||||||
if isPullList {
|
if isPullList {
|
||||||
MustEnablePulls(ctx)
|
MustAllowPulls(ctx)
|
||||||
if ctx.Written() {
|
if ctx.Written() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue