Переглянути джерело

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

tags/v1.6.0-dev
Lunny Xiao 5 роки тому
джерело
коміт
e48df3ee47
1 змінених файлів з 9 додано та 1 видалено
  1. 9
    1
      routers/api/v1/api.go

+ 9
- 1
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)

Завантаження…
Відмінити
Зберегти