Fix the Manually Merged form (#23015) (#23017)

Backport #23015

---------

Co-authored-by: Jason Song <i@wolfogre.com>
This commit is contained in:
wxiaoguang 2023-02-21 18:04:29 +08:00 committed by GitHub
parent c50d4202ef
commit 7b3ffe5745
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 13 deletions

View file

@ -129,6 +129,7 @@
<div class="content"> <div class="content">
{{template "repo/pulls/status" .}} {{template "repo/pulls/status" .}}
{{$canAutoMerge := false}} {{$canAutoMerge := false}}
{{$showGeneralMergeForm := false}}
<div class="ui attached merge-section segment {{if not $.LatestCommitStatus}}no-header{{end}}"> <div class="ui attached merge-section segment {{if not $.LatestCommitStatus}}no-header{{end}}">
{{if .Issue.PullRequest.HasMerged}} {{if .Issue.PullRequest.HasMerged}}
<div class="item text"> <div class="item text">
@ -351,6 +352,7 @@
'textAutoMergeButtonWhenSucceed': {{$.locale.Tr "repo.pulls.auto_merge_button_when_succeed"}}, 'textAutoMergeButtonWhenSucceed': {{$.locale.Tr "repo.pulls.auto_merge_button_when_succeed"}},
'textAutoMergeWhenSucceed': {{$.locale.Tr "repo.pulls.auto_merge_when_succeed"}}, 'textAutoMergeWhenSucceed': {{$.locale.Tr "repo.pulls.auto_merge_when_succeed"}},
'textAutoMergeCancelSchedule': {{$.locale.Tr "repo.pulls.auto_merge_cancel_schedule"}}, 'textAutoMergeCancelSchedule': {{$.locale.Tr "repo.pulls.auto_merge_cancel_schedule"}},
'textMergeCommitId': {{$.locale.Tr "repo.pulls.merge_commit_id"}},
'canMergeNow': {{$canMergeNow}}, 'canMergeNow': {{$canMergeNow}},
'allOverridableChecksOk': {{not $notAllOverridableChecksOk}}, 'allOverridableChecksOk': {{not $notAllOverridableChecksOk}},
@ -410,6 +412,7 @@
})(); })();
</script> </script>
{{$showGeneralMergeForm = true}}
<div id="pull-request-merge-form"></div> <div id="pull-request-merge-form"></div>
{{if .ShowMergeInstructions}} {{if .ShowMergeInstructions}}
@ -487,30 +490,21 @@
{{$.locale.Tr "repo.pulls.cannot_auto_merge_helper"}} {{$.locale.Tr "repo.pulls.cannot_auto_merge_helper"}}
</div> </div>
{{end}} {{end}}
{{end}} {{end}}{{/* end if: pull request status */}}
{{if $.StillCanManualMerge}} {{if and $.StillCanManualMerge (not $showGeneralMergeForm)}}
<div class="ui divider"></div> <div class="ui divider"></div>
<div class="ui form manually-merged-fields" style="display: none"> <div class="ui form">
<form action="{{.Link}}/merge" method="post"> <form action="{{.Link}}/merge" method="post">
{{.CsrfTokenHtml}} {{.CsrfTokenHtml}}
<div class="field"> <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> </div>
<button class="ui red button" type="submit" name="do" value="manually-merged"> <button class="ui red button" type="submit" name="do" value="manually-merged">
{{$.locale.Tr "repo.pulls.merge_manually"}} {{$.locale.Tr "repo.pulls.merge_manually"}}
</button> </button>
<button class="ui button merge-cancel">
{{$.locale.Tr "cancel"}}
</button>
</form> </form>
</div> </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}} {{end}}
</div> </div>
</div> </div>

View file

@ -28,6 +28,10 @@
</div> </div>
</template> </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"> <button class="ui button" :class="mergeButtonStyleClass" type="submit" name="do" :value="mergeStyle">
{{ mergeStyleDetail.textDoMerge }} {{ mergeStyleDetail.textDoMerge }}
<template v-if="autoMergeWhenSucceed"> <template v-if="autoMergeWhenSucceed">