From c0c8c138a0449351e5b32df45845e4193128196b Mon Sep 17 00:00:00 2001 From: silverwind Date: Thu, 14 Jul 2022 19:25:32 +0200 Subject: [PATCH 1/2] Remove Pull request button on repo homepage We have too many buttons on the repo frontpage and this seems like a obvious candidate to remove as it already exists in the Pull Requests tab where it makes more sense. FWIW, GitHub also no longer shows the button on a repo home page but they do have the recent-pushes flash feature which we lack. --- integrations/pull_create_test.go | 2 +- templates/repo/home.tmpl | 9 +-------- templates/repo/issue/list.tmpl | 2 +- 3 files changed, 3 insertions(+), 10 deletions(-) diff --git a/integrations/pull_create_test.go b/integrations/pull_create_test.go index 671b5e7551b50..dcbf5fd188e5a 100644 --- a/integrations/pull_create_test.go +++ b/integrations/pull_create_test.go @@ -16,7 +16,7 @@ import ( ) func testPullCreate(t *testing.T, session *TestSession, user, repo, branch, title string) *httptest.ResponseRecorder { - req := NewRequest(t, "GET", path.Join(user, repo)) + req := NewRequest(t, "GET", path.Join(user, repo, "pulls")) resp := session.MakeRequest(t, req, http.StatusOK) // Click the PR button to create a pull diff --git a/templates/repo/home.tmpl b/templates/repo/home.tmpl index 0734076eff490..11103856467e2 100644 --- a/templates/repo/home.tmpl +++ b/templates/repo/home.tmpl @@ -64,15 +64,8 @@ {{template "repo/branch_dropdown" dict "root" .}} {{ $n := len .TreeNames}} {{ $l := Subtract $n 1}} - + {{if eq $n 0}} - {{if and .CanCompareOrPull .IsViewBranch (not .Repository.IsArchived)}} -
- - - -
- {{end}}
{{.locale.Tr "repo.find_file.go_to_file"}} diff --git a/templates/repo/issue/list.tmpl b/templates/repo/issue/list.tmpl index 2a53239f1c6f7..ff425241595d7 100644 --- a/templates/repo/issue/list.tmpl +++ b/templates/repo/issue/list.tmpl @@ -14,7 +14,7 @@ {{if .PageIsIssueList}} {{.locale.Tr "repo.issues.new"}} {{else}} - {{.locale.Tr "repo.pulls.new"}} + {{.locale.Tr "repo.pulls.new"}} {{end}}
{{else}} From 797ee621d89188dfb5d55573b96d49a06d3f6853 Mon Sep 17 00:00:00 2001 From: silverwind Date: Thu, 14 Jul 2022 22:29:25 +0200 Subject: [PATCH 2/2] attempt to fix integration --- integrations/pull_create_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/integrations/pull_create_test.go b/integrations/pull_create_test.go index dcbf5fd188e5a..16b733adba0d3 100644 --- a/integrations/pull_create_test.go +++ b/integrations/pull_create_test.go @@ -21,7 +21,7 @@ func testPullCreate(t *testing.T, session *TestSession, user, repo, branch, titl // Click the PR button to create a pull htmlDoc := NewHTMLParser(t, resp.Body) - link, exists := htmlDoc.doc.Find("#new-pull-request").Parent().Attr("href") + link, exists := htmlDoc.doc.Find("#new-pull-request").Attr("href") assert.True(t, exists, "The template has changed") if branch != "master" { link = strings.Replace(link, ":master", ":"+branch, 1)