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

Update button is shown when a Pull Request is marked WIP - Issue #21740 #22683

Merged
merged 7 commits into from Feb 3, 2023
Merged
40 changes: 2 additions & 38 deletions templates/repo/issue/view_content/pull.tmpl
Expand Up @@ -190,6 +190,7 @@
{{end}}
</div>
</div>
{{template "repo/issue/view_content/update_branch_by_merge" (dict "locale" .locale "Issue" .Issue "UpdateAllowed" .UpdateAllowed "UpdateByRebaseAllowed" .UpdateByRebaseAllowed "Link" .Link)}}
{{else if .Issue.PullRequest.IsChecking}}
<div class="item">
<i class="icon icon-octicon">{{svg "octicon-sync"}}</i>
Expand Down Expand Up @@ -282,44 +283,7 @@
</div>
{{end}}
{{end}}
{{if and (gt .Issue.PullRequest.CommitsBehind 0) (not .Issue.IsClosed) (not .Issue.PullRequest.IsChecking) (not .IsPullFilesConflicted) (not .IsPullRequestBroken) (not $canAutoMerge)}}
<div class="ui divider"></div>
<div class="item item-section">
<div class="item-section-left">
<i class="icon icon-octicon">{{svg "octicon-alert"}}</i>
{{$.locale.Tr "repo.pulls.outdated_with_base_branch"}}
</div>
<div class="item-section-right">
{{if and .UpdateAllowed .UpdateByRebaseAllowed}}
<div class="dib">
<div class="ui buttons update-button">
<button class="ui button" data-do="{{.Link}}/update" data-redirect="{{.Link}}">
<span class="button-text">
{{$.locale.Tr "repo.pulls.update_branch"}}
</span>
</button>

<div class="ui dropdown icon button no-text">
{{svg "octicon-triangle-down" 14 "dropdown icon"}}
<div class="menu">
<div class="item active selected" data-do="{{.Link}}/update">{{$.locale.Tr "repo.pulls.update_branch"}}</div>
<div class="item" data-do="{{.Link}}/update?style=rebase">{{$.locale.Tr "repo.pulls.update_branch_rebase"}}</div>
</div>
</div>
</div>
</div>
{{end}}
{{if and .UpdateAllowed (not .UpdateByRebaseAllowed)}}
<form action="{{.Link}}/update" method="post" class="ui update-branch-form">
{{.CsrfTokenHtml}}
<button class="ui compact button" data-do="update">
<span class="ui text">{{$.locale.Tr "repo.pulls.update_branch"}}</span>
</button>
</form>
{{end}}
</div>
</div>
{{end}}
{{template "repo/issue/view_content/update_branch_by_merge" (dict "locale" .locale "Issue" .Issue "UpdateAllowed" .UpdateAllowed "UpdateByRebaseAllowed" .UpdateByRebaseAllowed "Link" .Link)}}
{{if .Issue.PullRequest.IsEmpty}}
<div class="ui divider"></div>

Expand Down
39 changes: 39 additions & 0 deletions templates/repo/issue/view_content/update_branch_by_merge.tmpl
@@ -0,0 +1,39 @@
{{$canAutoMerge := false}}
{{if and (gt .Issue.PullRequest.CommitsBehind 0) (not .Issue.IsClosed) (not .Issue.PullRequest.IsChecking) (not .IsPullFilesConflicted) (not .IsPullRequestBroken) (not $canAutoMerge)}}
<div class="ui divider"></div>
<div class="item item-section">
<div class="item-section-left">
<i class="icon icon-octicon">{{svg "octicon-alert"}}</i>
{{$.locale.Tr "repo.pulls.outdated_with_base_branch"}}
</div>
<div class="item-section-right">
{{if and .UpdateAllowed .UpdateByRebaseAllowed}}
<div class="dib">
<div class="ui buttons update-button">
<button class="ui button" data-do="{{.Link}}/update" data-redirect="{{.Link}}">
<span class="button-text">
{{$.locale.Tr "repo.pulls.update_branch"}}
</span>
</button>

<div class="ui dropdown icon button no-text">
{{svg "octicon-triangle-down" 14 "dropdown icon"}}
<div class="menu">
<div class="item active selected" data-do="{{.Link}}/update">{{$.locale.Tr "repo.pulls.update_branch"}}</div>
<div class="item" data-do="{{.Link}}/update?style=rebase">{{$.locale.Tr "repo.pulls.update_branch_rebase"}}</div>
</div>
</div>
</div>
</div>
{{end}}
{{if and .UpdateAllowed (not .UpdateByRebaseAllowed)}}
<form action="{{.Link}}/update" method="post" class="ui update-branch-form">
{{.CsrfTokenHtml}}
<button class="ui compact button" data-do="update">
<span class="ui text">{{$.locale.Tr "repo.pulls.update_branch"}}</span>
</button>
</form>
{{end}}
</div>
</div>
{{end}}