Skip to content

Commit e48df3e

Browse files
lunnytechknowlogick
authored andcommitted
issues api allow pulls and fix #4832 (#4852)
1 parent a4ee562 commit e48df3e

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

routers/api/v1/api.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,14 @@ func mustAllowPulls(ctx *context.Context) {
273273
}
274274
}
275275

276+
func mustEnableIssuesOrPulls(ctx *context.Context) {
277+
if !ctx.Repo.Repository.UnitEnabled(models.UnitTypeIssues) &&
278+
!ctx.Repo.Repository.AllowsPulls() {
279+
ctx.Status(404)
280+
return
281+
}
282+
}
283+
276284
// RegisterRoutes registers all v1 APIs routes to web application.
277285
// FIXME: custom form error response
278286
func RegisterRoutes(m *macaron.Macaron) {
@@ -450,7 +458,7 @@ func RegisterRoutes(m *macaron.Macaron) {
450458

451459
m.Combo("/deadline").Post(reqToken(), bind(api.EditDeadlineOption{}), repo.UpdateIssueDeadline)
452460
})
453-
}, mustEnableIssues)
461+
}, mustEnableIssuesOrPulls)
454462
m.Group("/labels", func() {
455463
m.Combo("").Get(repo.ListLabels).
456464
Post(reqToken(), bind(api.CreateLabelOption{}), repo.CreateLabel)

0 commit comments

Comments
 (0)