From bcc1e17775853ba0ff8da92584ee69568a0fac20 Mon Sep 17 00:00:00 2001 From: Gusted Date: Sun, 28 Jul 2024 02:29:58 +0200 Subject: [PATCH] [UI] Show AGit label on merged PR - The label wasn't show on merged PRs. - Integration test added (cherry picked from commit 358ec8002e0c88fefb737af2f1b7c2a32d00afd1) --- templates/repo/issue/view_title.tmpl | 9 +++++++++ tests/integration/git_test.go | 12 ++++++++++++ 2 files changed, 21 insertions(+) diff --git a/templates/repo/issue/view_title.tmpl b/templates/repo/issue/view_title.tmpl index 3a5ba0f4a3..1171b5936f 100644 --- a/templates/repo/issue/view_title.tmpl +++ b/templates/repo/issue/view_title.tmpl @@ -63,6 +63,15 @@ {{.Issue.PullRequest.Merger.GetDisplayName}} {{ctx.Locale.TrN .NumCommits "repo.pulls.merged_title_desc_one" "repo.pulls.merged_title_desc_few" .NumCommits $headHref $baseHref $mergedStr}} {{end}} + {{if .MadeUsingAGit}} + {{/* TODO: Move documentation link to the instructions at the bottom of the PR, show instructions when clicking label */}} + {{/* Note: #agit-label is necessary for testing whether the label appears when it should in tests/integration/git_test.go */}} + + + {{ctx.Locale.Tr "repo.pulls.made_using_agit"}} + + + {{end}} {{else}} {{if .Issue.OriginalAuthor}} {{.Issue.OriginalAuthor}} {{ctx.Locale.TrN .NumCommits "repo.pulls.title_desc_one" "repo.pulls.title_desc_few" .NumCommits $headHref $baseHref}} diff --git a/tests/integration/git_test.go b/tests/integration/git_test.go index 2dba9e277b..3ff3305587 100644 --- a/tests/integration/git_test.go +++ b/tests/integration/git_test.go @@ -1063,6 +1063,18 @@ func doCreateAgitFlowPull(dstPath string, ctx *APITestContext, baseBranch, headB }) t.Run("Merge", doAPIMergePullRequest(*ctx, ctx.Username, ctx.Reponame, pr1.Index)) + + t.Run("AGitLabelIsPresent Merged", func(t *testing.T) { + defer tests.PrintCurrentTest(t)() + + session := loginUser(t, ctx.Username) + + req := NewRequest(t, "GET", fmt.Sprintf("/%s/%s/pulls/%d", url.PathEscape(ctx.Username), url.PathEscape(ctx.Reponame), pr2.Index)) + resp := session.MakeRequest(t, req, http.StatusOK) + htmlDoc := NewHTMLParser(t, resp.Body) + htmlDoc.AssertElement(t, "#agit-label", true) + }) + t.Run("CheckoutMasterAgain", doGitCheckoutBranch(dstPath, "master")) } }