diff --git a/routers/web/repo/pull.go b/routers/web/repo/pull.go index 6e8f575ad..080eb0414 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 0d92393cb..e1766e78e 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, }, {