mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 18:28:37 +00:00
#3383 code cleanup
This commit is contained in:
@@ -110,6 +110,15 @@ func reqAdmin() macaron.Handler {
|
||||
}
|
||||
}
|
||||
|
||||
func reqRepoWriter() macaron.Handler {
|
||||
return func(ctx *context.Context) {
|
||||
if !ctx.Repo.IsWriter() {
|
||||
ctx.Error(403)
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func orgAssignment(args ...bool) macaron.Handler {
|
||||
var (
|
||||
assignOrg bool
|
||||
@@ -259,11 +268,6 @@ func RegisterRoutes(m *macaron.Macaron) {
|
||||
Delete(repo.ClearIssueLabels)
|
||||
m.Delete("/:id", repo.DeleteIssueLabel)
|
||||
})
|
||||
m.Group("/milestone", func() {
|
||||
m.Combo("").Get(repo.GetIssueMilestone).
|
||||
Post(bind(api.SetIssueMilestoneOption{}), repo.SetIssueMilestone).
|
||||
Delete(repo.DeleteIssueMilestone)
|
||||
})
|
||||
|
||||
})
|
||||
}, mustEnableIssues)
|
||||
@@ -275,10 +279,10 @@ func RegisterRoutes(m *macaron.Macaron) {
|
||||
})
|
||||
m.Group("/milestones", func() {
|
||||
m.Combo("").Get(repo.ListMilestones).
|
||||
Post(bind(api.CreateMilestoneOption{}), repo.CreateMilestone)
|
||||
m.Combo("/:id").Get(repo.GetMilestone).Patch(bind(api.EditMilestoneOption{}), repo.EditMilestone).
|
||||
Delete(repo.DeleteMilestone)
|
||||
m.Post("/:id/:action", repo.ChangeMilestoneStatus)
|
||||
Post(reqRepoWriter(), bind(api.CreateMilestoneOption{}), repo.CreateMilestone)
|
||||
m.Combo("/:id").Get(repo.GetMilestone).
|
||||
Patch(reqRepoWriter(), bind(api.EditMilestoneOption{}), repo.EditMilestone).
|
||||
Delete(reqRepoWriter(), repo.DeleteMilestone)
|
||||
})
|
||||
}, repoAssignment())
|
||||
}, reqToken())
|
||||
|
Reference in New Issue
Block a user