summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEarl Warren <earl-warren@noreply.codeberg.org>2024-07-29 17:32:51 +0200
committerEarl Warren <earl-warren@noreply.codeberg.org>2024-07-29 17:32:51 +0200
commitc47bdf436b6c7dc43933560a65763fb23a7ca5c9 (patch)
tree165a972432c3722749f6a718d4fffea0cbc00092
parentMerge pull request '[gitea] week 2024-31-v7.0 cherry pick (release/v1.22 -> v... (diff)
parent[UI] Show AGit label on merged PR (diff)
downloadforgejo-7.0.6.tar.xz
forgejo-7.0.6.zip
Merge pull request '[v7.0/forgejo] [UI] Show AGit label on merged PR' (#4731) from bp-v7.0/forgejo-358ec80 into v7.0/forgejov7.0.6
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4731 Reviewed-by: Gusted <gusted@noreply.codeberg.org>
-rw-r--r--templates/repo/issue/view_title.tmpl9
-rw-r--r--tests/integration/git_test.go12
2 files changed, 21 insertions, 0 deletions
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 @@
<a {{if gt .Issue.PullRequest.Merger.ID 0}}href="{{.Issue.PullRequest.Merger.HomeLink}}"{{end}}>{{.Issue.PullRequest.Merger.GetDisplayName}}</a>
<span class="pull-desc">{{ctx.Locale.TrN .NumCommits "repo.pulls.merged_title_desc_one" "repo.pulls.merged_title_desc_few" .NumCommits $headHref $baseHref $mergedStr}}</span>
{{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 */}}
+ <a target="_blank" rel="noopener" href="https://forgejo.org/docs/latest/user/agit-support/">
+ <span id="agit-label" data-tooltip-content="{{ctx.Locale.Tr "repo.pulls.agit_explanation"}}" class="ui small label">
+ {{ctx.Locale.Tr "repo.pulls.made_using_agit"}}
+ </span>
+ </a>
+ {{end}}
{{else}}
{{if .Issue.OriginalAuthor}}
<span id="pull-desc" class="pull-desc">{{.Issue.OriginalAuthor}} {{ctx.Locale.TrN .NumCommits "repo.pulls.title_desc_one" "repo.pulls.title_desc_few" .NumCommits $headHref $baseHref}}</span>
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"))
}
}