0
0
Fork 0
mirror of https://github.com/go-gitea/gitea synced 2024-11-17 23:41:49 +01:00

issues api allow pulls and fix #4832 (#4852)

This commit is contained in:
Lunny Xiao 2018-09-04 01:20:54 +08:00 committed by techknowlogick
parent a4ee5627ed
commit e48df3ee47

View file

@ -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. // 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) {
@ -450,7 +458,7 @@ func RegisterRoutes(m *macaron.Macaron) {
m.Combo("/deadline").Post(reqToken(), bind(api.EditDeadlineOption{}), repo.UpdateIssueDeadline) m.Combo("/deadline").Post(reqToken(), bind(api.EditDeadlineOption{}), repo.UpdateIssueDeadline)
}) })
}, mustEnableIssues) }, mustEnableIssuesOrPulls)
m.Group("/labels", func() { m.Group("/labels", func() {
m.Combo("").Get(repo.ListLabels). m.Combo("").Get(repo.ListLabels).
Post(reqToken(), bind(api.CreateLabelOption{}), repo.CreateLabel) Post(reqToken(), bind(api.CreateLabelOption{}), repo.CreateLabel)