Skip to content

Commit

Permalink
issues api allow pulls and fix go-gitea#4832 (go-gitea#4852)
Browse files Browse the repository at this point in the history
  • Loading branch information
lunny committed Sep 3, 2018
1 parent b1eaeeb commit dfe6f5a
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion routers/api/v1/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit dfe6f5a

Please sign in to comment.