don't allow pull requests to be created on an archived repository (#5883)

* don't allow pull requests to be created on an archived repository
Also disable the "PR" button if the repo is archived

* Refuse creating an issue/PR via API calls too
This commit is contained in:
Lanre Adelowo 2019-01-30 18:20:40 +01:00 committed by techknowlogick
parent 6dc2f401c9
commit 57a69ef277
3 changed files with 15 additions and 8 deletions

View file

@ -586,7 +586,7 @@ func RegisterRoutes(m *macaron.Macaron) {
m.Group("/milestone", func() {
m.Get("/:id", repo.MilestoneIssuesAndPulls)
}, reqRepoIssuesOrPullsWriter, context.RepoRef())
m.Combo("/compare/*", reqRepoCodeReader, reqRepoPullsReader, repo.MustAllowPulls, repo.SetEditorconfigIfExists).
m.Combo("/compare/*", context.RepoMustNotBeArchived(), reqRepoCodeReader, reqRepoPullsReader, repo.MustAllowPulls, repo.SetEditorconfigIfExists).
Get(repo.SetDiffViewStyle, repo.CompareAndPullRequest).
Post(bindIgnErr(auth.CreateIssueForm{}), repo.CompareAndPullRequestPost)