From 76accb51ed23c2170e80a1a4f8b2142c8b1114fc Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Thu, 4 Aug 2022 11:11:59 +0800 Subject: [PATCH] Add default commit messages to PR for squash merge (#20618) (#20645) Keep the same behavior as 1.16 Co-authored-by: wxiaoguang Co-authored-by: John Olheiser Co-authored-by: Tyrone Yeh Co-authored-by: John Olheiser --- routers/web/repo/pull.go | 2 ++ templates/repo/issue/view_content/pull.tmpl | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/routers/web/repo/pull.go b/routers/web/repo/pull.go index 6e8f575ad54a5..080eb04148bb4 100644 --- a/routers/web/repo/pull.go +++ b/routers/web/repo/pull.go @@ -510,6 +510,8 @@ func PrepareViewPullInfo(ctx *context.Context, issue *issues_model.Issue) *git.C return nil } ctx.Data["GetCommitMessages"] = pull_service.GetSquashMergeCommitMessages(ctx, pull) + } else { + ctx.Data["GetCommitMessages"] = "" } sha, err := baseGitRepo.GetRefCommitID(pull.GetGitRefName()) diff --git a/templates/repo/issue/view_content/pull.tmpl b/templates/repo/issue/view_content/pull.tmpl index 0d92393cb2726..e1766e78e5800 100644 --- a/templates/repo/issue/view_content/pull.tmpl +++ b/templates/repo/issue/view_content/pull.tmpl @@ -396,7 +396,7 @@ 'allowed': {{$prUnit.PullRequestsConfig.AllowSquash}}, 'textDoMerge': {{$.i18n.Tr "repo.pulls.squash_merge_pull_request"}}, 'mergeTitleFieldText': defaultSquashMergeTitle, - 'mergeMessageFieldText': defaultMergeMessage, + 'mergeMessageFieldText': {{.GetCommitMessages}} + defaultMergeMessage, 'hideAutoMerge': generalHideAutoMerge, }, {