forked from p85947160/gitea
parent
745c898561
commit
1901f35980
|
@ -273,6 +273,14 @@ func mustAllowPulls(ctx *context.Context) {
|
|||
}
|
||||
}
|
||||
|
||||
func mustEnableIssuesOrPulls(ctx *context.Context) {
|
||||
if !ctx.Repo.Repository.UnitEnabled(models.UnitTypeIssues) &&
|
||||
!ctx.Repo.Repository.AllowsPulls() {
|
||||
ctx.Status(404)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// RegisterRoutes registers all v1 APIs routes to web application.
|
||||
// FIXME: custom form error response
|
||||
func RegisterRoutes(m *macaron.Macaron) {
|
||||
|
@ -447,7 +455,7 @@ func RegisterRoutes(m *macaron.Macaron) {
|
|||
Post(reqToken(), bind(api.AddTimeOption{}), repo.AddTime)
|
||||
})
|
||||
})
|
||||
}, mustEnableIssues)
|
||||
}, mustEnableIssuesOrPulls)
|
||||
m.Group("/labels", func() {
|
||||
m.Combo("").Get(repo.ListLabels).
|
||||
Post(reqToken(), bind(api.CreateLabelOption{}), repo.CreateLabel)
|
||||
|
|
Loading…
Reference in New Issue