Skip to content

Commit eb02921

Browse files
committed
don't allow pull requests to be created on an archived repository
Also disable the "PR" button if the repo is archived
1 parent 5f4a40c commit eb02921

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

routers/routes/routes.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -586,7 +586,7 @@ func RegisterRoutes(m *macaron.Macaron) {
586586
m.Group("/milestone", func() {
587587
m.Get("/:id", repo.MilestoneIssuesAndPulls)
588588
}, reqRepoIssuesOrPullsWriter, context.RepoRef())
589-
m.Combo("/compare/*", reqRepoCodeReader, reqRepoPullsReader, repo.MustAllowPulls, repo.SetEditorconfigIfExists).
589+
m.Combo("/compare/*", context.RepoMustNotBeArchived(), reqRepoCodeReader, reqRepoPullsReader, repo.MustAllowPulls, repo.SetEditorconfigIfExists).
590590
Get(repo.SetDiffViewStyle, repo.CompareAndPullRequest).
591591
Post(bindIgnErr(auth.CreateIssueForm{}), repo.CompareAndPullRequestPost)
592592

templates/repo/home.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
{{end}}
5858
{{template "repo/sub_menu" .}}
5959
<div class="ui stackable secondary menu mobile--margin-between-items mobile--no-negative-margins">
60-
{{if and .PullRequestCtx.Allowed .IsViewBranch}}
60+
{{if and .PullRequestCtx.Allowed .IsViewBranch (not .Repository.IsArchived)}}
6161
<div class="fitted item">
6262
<a href="{{.BaseRepo.Link}}/compare/{{.BaseRepo.DefaultBranch | EscapePound}}...{{.Repository.Owner.Name}}:{{.BranchName | EscapePound}}">
6363
<button class="ui green tiny compact button"><i class="octicon octicon-git-compare"></i></button>

0 commit comments

Comments
 (0)