Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the Manually Merged form #23015

Merged
merged 5 commits into from
Feb 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 7 additions & 13 deletions templates/repo/issue/view_content/pull.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@
<div class="content">
{{template "repo/pulls/status" .}}
{{$canAutoMerge := false}}
{{$showGeneralMergeForm := false}}
<div class="ui attached merge-section segment {{if not $.LatestCommitStatus}}no-header{{end}}">
{{if .Issue.PullRequest.HasMerged}}
<div class="item text">
Expand Down Expand Up @@ -320,6 +321,7 @@
'textAutoMergeCancelSchedule': {{$.locale.Tr "repo.pulls.auto_merge_cancel_schedule"}},
'textClearMergeMessage': {{$.locale.Tr "repo.pulls.clear_merge_message"}},
'textClearMergeMessageHint': {{$.locale.Tr "repo.pulls.clear_merge_message_hint"}},
'textMergeCommitId': {{$.locale.Tr "repo.pulls.merge_commit_id"}},

'canMergeNow': {{$canMergeNow}},
'allOverridableChecksOk': {{not $notAllOverridableChecksOk}},
Expand Down Expand Up @@ -379,6 +381,7 @@
window.config.pageData.pullRequestMergeForm = mergeForm;
</script>

{{$showGeneralMergeForm = true}}
<div id="pull-request-merge-form"></div>
{{else}}
{{/* no merge style was set in repo setting: not or ($prUnit.PullRequestsConfig.AllowMerge ...) */}}
Expand Down Expand Up @@ -452,30 +455,21 @@
{{$.locale.Tr "repo.pulls.cannot_auto_merge_helper"}}
</div>
{{end}}
{{end}}
{{end}}{{/* end if: pull request status */}}

{{if $.StillCanManualMerge}}
{{if and $.StillCanManualMerge (not $showGeneralMergeForm)}}
<div class="ui divider"></div>
<div class="ui form manually-merged-fields gt-hidden">
<div class="ui form">
<form action="{{.Link}}/merge" method="post">
{{.CsrfTokenHtml}}
<div class="field">
<input type="text" name="merge_commit_id" placeholder="{{$.locale.Tr "repo.pulls.merge_commit_id"}}">
<input type="text" name="merge_commit_id" placeholder="{{$.locale.Tr "repo.pulls.merge_commit_id"}}">
</div>
<button class="ui red button" type="submit" name="do" value="manually-merged">
{{$.locale.Tr "repo.pulls.merge_manually"}}
</button>
<button class="ui button merge-cancel">
{{$.locale.Tr "cancel"}}
</button>
</form>
</div>

<div class="ui red buttons merge-button">
<button class="ui button" data-do="manually-merged">
{{$.locale.Tr "repo.pulls.merge_manually"}}
</button>
</div>
{{end}}

{{if and .ShowMergeInstructions .Issue.PullRequest.HeadRepo}}
Expand Down
4 changes: 4 additions & 0 deletions web_src/js/components/PullRequestMergeForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@
</div>
</template>

<div class="field" v-if="mergeStyle === 'manually-merged'">
<input type="text" name="merge_commit_id" :placeholder="mergeForm.textMergeCommitId">
</div>

<button class="ui button" :class="mergeButtonStyleClass" type="submit" name="do" :value="mergeStyle">
{{ mergeStyleDetail.textDoMerge }}
<template v-if="autoMergeWhenSucceed">
Expand Down