mirror of
https://codeberg.org/forgejo/forgejo
synced 2024-11-25 03:06:10 +01:00
8ac1501ad7
* Pull request options migration and UI in settings * Add ignore whitespace functionality * Fix settings if pull requests are disabled * Fix migration transaction * Merge with Rebase functionality * UI changes and related functionality for pull request merging button * Implement squash functionality * Fix rebase merging * Fix pull request merge tests * Add squash and rebase tests * Fix API method to reuse default message functions * Some refactoring and small fixes * Remove more hardcoded values from tests * Remove unneeded check from API method * Fix variable name and comment typo * Fix reset commit count after PR merge
149 lines
5.8 KiB
Cheetah
149 lines
5.8 KiB
Cheetah
<div class="comment merge box">
|
|
<a class="avatar text
|
|
{{if .Issue.PullRequest.HasMerged}}purple
|
|
{{else if .Issue.IsClosed}}grey
|
|
{{else if .IsPullReuqestBroken}}red
|
|
{{else if .Issue.PullRequest.IsChecking}}yellow
|
|
{{else if .Issue.PullRequest.CanAutoMerge}}green
|
|
{{else}}red{{end}}"><span class="mega-octicon octicon-git-merge"></span></a>
|
|
<div class="content">
|
|
<div class="ui merge segment">
|
|
{{if .Issue.PullRequest.HasMerged}}
|
|
<div class="item text purple">
|
|
{{$.i18n.Tr "repo.pulls.has_merged"}}
|
|
</div>
|
|
{{if .IsPullBranchDeletable}}
|
|
<div class="ui divider"></div>
|
|
<div>
|
|
<a class="delete-button ui red button" href="" data-url="{{.DeleteBranchLink}}">{{$.i18n.Tr "repo.branch.delete" .HeadTarget}}</a>
|
|
</div>
|
|
{{end}}
|
|
{{else if .Issue.IsClosed}}
|
|
<div class="item text grey">
|
|
{{$.i18n.Tr "repo.pulls.reopen_to_merge"}}
|
|
</div>
|
|
{{else if .IsPullReuqestBroken}}
|
|
<div class="item text red">
|
|
<span class="octicon octicon-x"></span>
|
|
{{$.i18n.Tr "repo.pulls.data_broken"}}
|
|
</div>
|
|
{{else if .Issue.PullRequest.IsChecking}}
|
|
<div class="item text yellow">
|
|
<span class="octicon octicon-sync"></span>
|
|
{{$.i18n.Tr "repo.pulls.is_checking"}}
|
|
</div>
|
|
{{else if .Issue.PullRequest.CanAutoMerge}}
|
|
<div class="item text green">
|
|
<span class="octicon octicon-check"></span>
|
|
{{$.i18n.Tr "repo.pulls.can_auto_merge_desc"}}
|
|
</div>
|
|
{{if .IsRepositoryWriter}}
|
|
{{$prUnit := .Repository.MustGetUnit $.UnitTypePullRequests}}
|
|
{{if or $prUnit.PullRequestsConfig.AllowMerge $prUnit.PullRequestsConfig.AllowRebase $prUnit.PullRequestsConfig.AllowSquash}}
|
|
<div class="ui divider"></div>
|
|
{{if $prUnit.PullRequestsConfig.AllowMerge}}
|
|
<div class="ui form merge-fields" style="display: none">
|
|
<form action="{{.Link}}/merge" method="post">
|
|
{{.CsrfTokenHtml}}
|
|
<div class="field">
|
|
<input type="text" name="merge_title_field" value="{{.Issue.PullRequest.GetDefaultMergeMessage}}">
|
|
</div>
|
|
<div class="field">
|
|
<textarea name="merge_message_field" rows="5" placeholder="{{$.i18n.Tr "repo.editor.commit_message_desc"}}"></textarea>
|
|
</div>
|
|
<button class="ui green button" type="submit" name="do" value="merge">
|
|
{{$.i18n.Tr "repo.pulls.merge_pull_request"}}
|
|
</button>
|
|
<button class="ui button merge-cancel">
|
|
{{$.i18n.Tr "cancel"}}
|
|
</button>
|
|
</form>
|
|
</div>
|
|
{{end}}
|
|
{{if $prUnit.PullRequestsConfig.AllowRebase}}
|
|
<div class="ui form rebase-fields" style="display: none">
|
|
<form action="{{.Link}}/merge" method="post">
|
|
{{.CsrfTokenHtml}}
|
|
<button class="ui green button" type="submit" name="do" value="rebase">
|
|
{{$.i18n.Tr "repo.pulls.rebase_merge_pull_request"}}
|
|
</button>
|
|
<button class="ui button merge-cancel">
|
|
{{$.i18n.Tr "cancel"}}
|
|
</button>
|
|
</form>
|
|
</div>
|
|
{{end}}
|
|
{{if $prUnit.PullRequestsConfig.AllowSquash}}
|
|
<div class="ui form squash-fields" style="display: none">
|
|
<form action="{{.Link}}/merge" method="post">
|
|
{{.CsrfTokenHtml}}
|
|
<div class="field">
|
|
<input type="text" name="merge_title_field" value="{{.Issue.PullRequest.GetDefaultSquashMessage}}">
|
|
</div>
|
|
<div class="field">
|
|
<textarea name="merge_message_field" rows="5" placeholder="{{$.i18n.Tr "repo.editor.commit_message_desc"}}"></textarea>
|
|
</div>
|
|
<button class="ui green button" type="submit" name="do" value="squash">
|
|
{{$.i18n.Tr "repo.pulls.squash_merge_pull_request"}}
|
|
</button>
|
|
<button class="ui button merge-cancel">
|
|
{{$.i18n.Tr "cancel"}}
|
|
</button>
|
|
</form>
|
|
</div>
|
|
{{end}}
|
|
<div class="ui green buttons merge-button">
|
|
<button class="ui button" data-do="{{.MergeStyle}}">
|
|
<span class="octicon octicon-git-merge"></span>
|
|
<span class="button-text">
|
|
{{if eq .MergeStyle "merge"}}
|
|
{{$.i18n.Tr "repo.pulls.merge_pull_request"}}
|
|
{{end}}
|
|
{{if eq .MergeStyle "rebase"}}
|
|
{{$.i18n.Tr "repo.pulls.rebase_merge_pull_request"}}
|
|
{{end}}
|
|
{{if eq .MergeStyle "squash"}}
|
|
{{$.i18n.Tr "repo.pulls.squash_merge_pull_request"}}
|
|
{{end}}
|
|
</span>
|
|
</button>
|
|
<div class="ui dropdown icon button">
|
|
<i class="dropdown icon"></i>
|
|
<div class="menu">
|
|
{{if $prUnit.PullRequestsConfig.AllowMerge}}
|
|
<div class="item{{if eq .MergeStyle "merge"}} active selected{{end}}" data-do="merge">{{$.i18n.Tr "repo.pulls.merge_pull_request"}}</div>
|
|
{{end}}
|
|
{{if $prUnit.PullRequestsConfig.AllowRebase}}
|
|
<div class="item{{if eq .MergeStyle "rebase"}} active selected{{end}}" data-do="rebase">{{$.i18n.Tr "repo.pulls.rebase_merge_pull_request"}}</div>
|
|
{{end}}
|
|
{{if $prUnit.PullRequestsConfig.AllowSquash}}
|
|
<div class="item{{if eq .MergeStyle "squash"}} active selected{{end}}" data-do="squash">{{$.i18n.Tr "repo.pulls.squash_merge_pull_request"}}</div>
|
|
{{end}}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{{else}}
|
|
<div class="item text red">
|
|
<span class="octicon octicon-x"></span>
|
|
{{$.i18n.Tr "repo.pulls.no_merge_desc"}}
|
|
</div>
|
|
<div class="item text grey">
|
|
<span class="octicon octicon-info"></span>
|
|
{{$.i18n.Tr "repo.pulls.no_merge_helper"}}
|
|
</div>
|
|
{{end}}
|
|
{{end}}
|
|
{{else}}
|
|
<div class="item text red">
|
|
<span class="octicon octicon-x"></span>
|
|
{{$.i18n.Tr "repo.pulls.cannot_auto_merge_desc"}}
|
|
</div>
|
|
<div class="item text grey">
|
|
<span class="octicon octicon-info"></span>
|
|
{{$.i18n.Tr "repo.pulls.cannot_auto_merge_helper"}}
|
|
</div>
|
|
{{end}}
|
|
</div>
|
|
</div>
|
|
</div>
|