File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff 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
278286func 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 )
You can’t perform that action at this time.
0 commit comments