Rename MustEnablePulls() to MustAllowPulls() and simplify the contained check to AllowsPulls().

This commit is contained in:
Download-Fritz 2016-02-19 20:48:32 +01:00
parent a467184e13
commit a1b28fc33c
2 changed files with 6 additions and 8 deletions

View file

@ -47,11 +47,9 @@ func MustEnableIssues(ctx *middleware.Context) {
}
}
func MustEnablePulls(ctx *middleware.Context) {
if !ctx.Repo.Repository.CanEnablePulls() {
ctx.Handle(404, "Unsupported", nil)
} else if !ctx.Repo.Repository.EnablePulls {
ctx.Handle(404, "MustEnablePulls", nil)
func MustAllowPulls(ctx *middleware.Context) {
if !ctx.Repo.Repository.AllowsPulls() {
ctx.Handle(404, "MustAllowPulls", nil)
}
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) {
isPullList := ctx.Params(":type") == "pulls"
if isPullList {
MustEnablePulls(ctx)
MustAllowPulls(ctx)
if ctx.Written() {
return
}