From b2fa4583c3189958bb3f7c233669ffef7c3da920 Mon Sep 17 00:00:00 2001 From: Tyrone Yeh Date: Wed, 3 Aug 2022 12:56:59 +0800 Subject: [PATCH] Add default commit messages to PR for squash merge (#20618) Keep the same behavior as 1.16 Co-authored-by: wxiaoguang 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 2a961c3cbc554..7c140a4e5991e 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 59e0962d1795d..fd901f013ebdb 100644 --- a/templates/repo/issue/view_content/pull.tmpl +++ b/templates/repo/issue/view_content/pull.tmpl @@ -395,7 +395,7 @@ 'allowed': {{$prUnit.PullRequestsConfig.AllowSquash}}, 'textDoMerge': {{$.locale.Tr "repo.pulls.squash_merge_pull_request"}}, 'mergeTitleFieldText': defaultSquashMergeTitle, - 'mergeMessageFieldText': defaultMergeMessage, + 'mergeMessageFieldText': {{.GetCommitMessages}} + defaultMergeMessage, 'hideAutoMerge': generalHideAutoMerge, }, {