diff --git a/templates/repo/issue/view_content/pull.tmpl b/templates/repo/issue/view_content/pull.tmpl index 58d85dbf1b..bc578a6f4c 100644 --- a/templates/repo/issue/view_content/pull.tmpl +++ b/templates/repo/issue/view_content/pull.tmpl @@ -199,7 +199,7 @@ {{if .AllowMerge}} {{/* user is allowed to merge */}} {{$prUnit := .Repository.MustGetUnit $.Context $.UnitTypePullRequests}} - {{if or $prUnit.PullRequestsConfig.AllowMerge $prUnit.PullRequestsConfig.AllowRebase $prUnit.PullRequestsConfig.AllowRebaseMerge $prUnit.PullRequestsConfig.AllowSquash $prUnit.PullRequestsConfig.AllowFastForwardOnly}} + {{if or $prUnit.PullRequestsConfig.AllowMerge $prUnit.PullRequestsConfig.AllowRebase $prUnit.PullRequestsConfig.AllowRebaseMerge $prUnit.PullRequestsConfig.AllowSquash $prUnit.PullRequestsConfig.AllowFastForwardOnly $prUnit.PullRequestsConfig.AllowManualMerge}} {{$hasPendingPullRequestMergeTip := ""}} {{if .HasPendingPullRequestMerge}} {{$createdPRMergeStr := DateUtils.TimeSince .PendingPullRequestMerge.CreatedUnix}} diff --git a/tests/integration/pull_test.go b/tests/integration/pull_test.go index fd9dbf8888..36daf35f7b 100644 --- a/tests/integration/pull_test.go +++ b/tests/integration/pull_test.go @@ -136,3 +136,24 @@ func TestPullCombinedReviewRequest(t *testing.T) { helper(t, "detach", "9", "removed review request for user11") helper(t, "detach", "2", "removed review requests for user11, user2") } + +func TestShowMergeForManualMerge(t *testing.T) { + defer tests.PrintCurrentTest(t)() + + // Only allow manual merge strategy for this repository. + pullRepoUnit := unittest.AssertExistsAndLoadBean(t, &repo_model.RepoUnit{ID: 5, RepoID: 1, Type: unit.TypePullRequests}) + pullRepoUnit.Config = &repo_model.PullRequestsConfig{ + AllowManualMerge: true, + DefaultMergeStyle: repo_model.MergeStyleManuallyMerged, + } + repo_model.UpdateRepoUnit(t.Context(), pullRepoUnit) + + session := loginUser(t, "user2") + + req := NewRequest(t, "GET", "/user2/repo1/pulls/5") + resp := session.MakeRequest(t, req, http.StatusOK) + + // Assert that the mergebox is shown. + htmlDoc := NewHTMLParser(t, resp.Body) + htmlDoc.AssertElement(t, "#pull-request-merge-form", true) +}