diff options
author | Max Wipfli <mail@maxwipfli.ch> | 2024-06-06 10:35:04 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-06 08:35:04 +0000 |
commit | da4bbc42477ba04d175cc0775a0c5ec90c4c24fe (patch) | |
tree | d822388bdebe835b480eb8d581428416c4acb567 /templates/repo/issue | |
parent | f7125ab61aaa02fd4c7ab0062a2dc9a57726e2ec (diff) | |
download | gitea-da4bbc42477ba04d175cc0775a0c5ec90c4c24fe.tar.gz gitea-da4bbc42477ba04d175cc0775a0c5ec90c4c24fe.zip |
Allow including `Reviewed-on`/`Reviewed-by` lines for custom merge messages (#31211)
This PR introduces the `ReviewedOn` and `ReviewedBy` variables for the
default merge message templates (e.g.,
`.gitea/default_merge_message/MERGE_TEMPLATE.md`).
This allows customizing the default merge messages while retaining these
trailers.
This also moves the associated logic out of `pull.tmpl` into the
relevant Go function.
This is a first contribution towards #11077.
---
For illustration, this allows to recreate the "default default" merge
message with the following template:
```
.gitea/default_merge_message/MERGE_TEMPLATE.md
Merge pull request '${PullRequestTitle}' (${PullRequestReference}) from ${HeadBranch} into ${BaseBranch}
${ReviewedOn}
${ReviewedBy}
```
Diffstat (limited to 'templates/repo/issue')
-rw-r--r-- | templates/repo/issue/view_content/pull.tmpl | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/templates/repo/issue/view_content/pull.tmpl b/templates/repo/issue/view_content/pull.tmpl index 77378ef1bd..69e74da3a0 100644 --- a/templates/repo/issue/view_content/pull.tmpl +++ b/templates/repo/issue/view_content/pull.tmpl @@ -199,7 +199,6 @@ {{if .AllowMerge}} {{/* user is allowed to merge */}} {{$prUnit := .Repository.MustGetUnit $.Context ctx.Consts.RepoUnitTypePullRequests}} - {{$approvers := (.Issue.PullRequest.GetApprovers ctx)}} {{if or $prUnit.PullRequestsConfig.AllowMerge $prUnit.PullRequestsConfig.AllowRebase $prUnit.PullRequestsConfig.AllowRebaseMerge $prUnit.PullRequestsConfig.AllowSquash $prUnit.PullRequestsConfig.AllowFastForwardOnly}} {{$hasPendingPullRequestMergeTip := ""}} {{if .HasPendingPullRequestMerge}} @@ -208,11 +207,10 @@ {{end}} <div class="divider"></div> <script type="module"> - const issueUrl = window.location.origin + {{$.Issue.Link}}; const defaultMergeTitle = {{.DefaultMergeMessage}}; const defaultSquashMergeTitle = {{.DefaultSquashMergeMessage}}; - const defaultMergeMessage = {{if .DefaultMergeBody}}{{.DefaultMergeBody}}{{else}}`Reviewed-on: ${issueUrl}\n` + {{$approvers}}{{end}}; - const defaultSquashMergeMessage = {{if .DefaultSquashMergeBody}}{{.DefaultSquashMergeBody}}{{else}}`Reviewed-on: ${issueUrl}\n` + {{$approvers}}{{end}}; + const defaultMergeMessage = {{.DefaultMergeBody}}; + const defaultSquashMergeMessage = {{.DefaultSquashMergeBody}}; const mergeForm = { 'baseLink': {{.Link}}, 'textCancel': {{ctx.Locale.Tr "cancel"}}, |