diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2018-09-04 01:20:54 +0800 |
---|---|---|
committer | techknowlogick <techknowlogick@users.noreply.github.com> | 2018-09-03 13:20:54 -0400 |
commit | e48df3ee47cca7cbf369f429c188332982a4b8e7 (patch) | |
tree | 54dab0c56c810fe0f92e653dac19c16f675b5e94 /routers/api/v1/api.go | |
parent | a4ee5627ed17e504c4c516b715dd05052f8fa828 (diff) | |
download | gitea-e48df3ee47cca7cbf369f429c188332982a4b8e7.tar.gz gitea-e48df3ee47cca7cbf369f429c188332982a4b8e7.zip |
issues api allow pulls and fix #4832 (#4852)
Diffstat (limited to 'routers/api/v1/api.go')
-rw-r--r-- | routers/api/v1/api.go | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/routers/api/v1/api.go b/routers/api/v1/api.go index 5d47570c5f..47a8edab43 100644 --- a/routers/api/v1/api.go +++ b/routers/api/v1/api.go @@ -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) { @@ -450,7 +458,7 @@ func RegisterRoutes(m *macaron.Macaron) { m.Combo("/deadline").Post(reqToken(), bind(api.EditDeadlineOption{}), repo.UpdateIssueDeadline) }) - }, mustEnableIssues) + }, mustEnableIssuesOrPulls) m.Group("/labels", func() { m.Combo("").Get(repo.ListLabels). Post(reqToken(), bind(api.CreateLabelOption{}), repo.CreateLabel) |