forked from Shiloh/githaven
e5d8e2d10c
Once a branch has been merged if the commit ID no longer equals that of the pulls ref commit id don't offer to delete the branch on the pull screen and don't list it as merged on branches. Fix #9201 When looking at the pull page we should also get the commits from the refs/pulls/x/head Fix #9158
275 lines
11 KiB
Cheetah
275 lines
11 KiB
Cheetah
{{if gt (len .PullReviewers) 0}}
|
|
<div class="comment box">
|
|
<div class="content">
|
|
<div class="ui segment">
|
|
<h4>{{$.i18n.Tr "repo.issues.review.reviewers"}}</h4>
|
|
{{range .PullReviewers}}
|
|
{{ $createdStr:= TimeSinceUnix .UpdatedUnix $.Lang }}
|
|
<div class="ui divider"></div>
|
|
<div class="review-item">
|
|
<span class="type-icon text {{if eq .Type 1}}green
|
|
{{else if eq .Type 2}}grey
|
|
{{else if eq .Type 3}}red
|
|
{{else}}grey{{end}}">
|
|
<span class="octicon octicon-{{.Type.Icon}}"></span>
|
|
</span>
|
|
<a class="ui avatar image" href="{{.Reviewer.HomeLink}}">
|
|
<img src="{{.Reviewer.RelAvatarLink}}">
|
|
</a>
|
|
<span class="text grey"><a href="{{.Reviewer.HomeLink}}">{{.Reviewer.Name}}</a>
|
|
{{if eq .Type 1}}
|
|
{{$.i18n.Tr "repo.issues.review.approve" $createdStr | Safe}}
|
|
{{else if eq .Type 2}}
|
|
{{$.i18n.Tr "repo.issues.review.comment" $createdStr | Safe}}
|
|
{{else if eq .Type 3}}
|
|
{{$.i18n.Tr "repo.issues.review.reject" $createdStr | Safe}}
|
|
{{else}}
|
|
{{$.i18n.Tr "repo.issues.review.comment" $createdStr | Safe}}
|
|
{{end}}
|
|
</span>
|
|
</div>
|
|
{{end}}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{{end}}
|
|
<div class="comment merge box">
|
|
<a class="avatar text
|
|
{{if .Issue.PullRequest.HasMerged}}purple
|
|
{{else if .Issue.IsClosed}}grey
|
|
{{else if .IsPullWorkInProgress}}grey
|
|
{{else if .IsFilesConflicted}}grey
|
|
{{else if .IsPullRequestBroken}}red
|
|
{{else if .IsBlockedByApprovals}}red
|
|
{{else if .IsBlockedByRejection}}red
|
|
{{else if and .EnableStatusCheck (not .IsRequiredStatusCheckSuccess)}}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">
|
|
{{template "repo/pulls/status" .}}
|
|
<div class="ui {{if not $.LatestCommitStatus}}top attached header{{else}}attached merge-section segment{{end}}">
|
|
{{if .Issue.PullRequest.HasMerged}}
|
|
<div class="item text purple">
|
|
{{if .Issue.PullRequest.MergedCommitID}}
|
|
{{$link := printf "%s/commit/%s" $.Repository.HTMLURL .Issue.PullRequest.MergedCommitID}}
|
|
{{$.i18n.Tr "repo.pulls.merged_as" $link (ShortSha .Issue.PullRequest.MergedCommitID) | Safe}}
|
|
{{else}}
|
|
{{$.i18n.Tr "repo.pulls.has_merged"}}
|
|
{{end}}
|
|
</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">
|
|
{{if .IsPullRequestBroken}}
|
|
{{$.i18n.Tr "repo.pulls.cant_reopen_deleted_branch"}}
|
|
{{else}}
|
|
{{$.i18n.Tr "repo.pulls.reopen_to_merge"}}
|
|
{{end}}
|
|
</div>
|
|
{{if and .IsPullBranchDeletable ( not .IsPullRequestBroken )}}
|
|
<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 .IsPullFilesConflicted}}
|
|
<div class="item text grey">
|
|
<span class="octicon octicon-x"></span>
|
|
{{$.i18n.Tr "repo.pulls.files_conflicted"}}
|
|
{{range .ConflictedFiles}}
|
|
<div>{{.}}</div>
|
|
{{end}}
|
|
</div>
|
|
{{else if .IsPullRequestBroken}}
|
|
<div class="item text red">
|
|
<span class="octicon octicon-x"></span>
|
|
{{$.i18n.Tr "repo.pulls.data_broken"}}
|
|
</div>
|
|
{{else if .IsPullWorkInProgress}}
|
|
<div class="item text grey">
|
|
<span class="octicon octicon-x"></span>
|
|
{{$.i18n.Tr "repo.pulls.cannot_merge_work_in_progress" .WorkInProgressPrefix | Str2html}}
|
|
</div>
|
|
{{else if .IsBlockedByApprovals}}
|
|
<div class="item text red">
|
|
<span class="octicon octicon-x"></span>
|
|
{{$.i18n.Tr "repo.pulls.blocked_by_approvals" .GrantedApprovals .Issue.PullRequest.ProtectedBranch.RequiredApprovals}}
|
|
</div>
|
|
{{else if .IsBlockedByRejection}}
|
|
<div class="item text red">
|
|
<span class="octicon octicon-x"></span>
|
|
{{$.i18n.Tr "repo.pulls.blocked_by_rejection"}}
|
|
</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 and (not .Issue.PullRequest.CanAutoMerge) .EnableStatusCheck (not .IsRequiredStatusCheckSuccess)}}
|
|
<div class="item text red">
|
|
<span class="octicon octicon-x"></span>
|
|
{{$.i18n.Tr "repo.pulls.required_status_check_failed"}}
|
|
</div>
|
|
{{else if .Issue.PullRequest.CanAutoMerge}}
|
|
{{if and .EnableStatusCheck (not .IsRequiredStatusCheckSuccess)}}
|
|
<div class="item text red">
|
|
<span class="octicon octicon-x"></span>
|
|
{{$.i18n.Tr "repo.pulls.required_status_check_failed"}}
|
|
</div>
|
|
{{end}}
|
|
{{if or $.IsRepoAdmin (not .EnableStatusCheck) .IsRequiredStatusCheckSuccess}}
|
|
{{if and $.IsRepoAdmin .EnableStatusCheck (not .IsRequiredStatusCheckSuccess)}}
|
|
<div class="item text yellow">
|
|
<span class="octicon octicon-primitive-dot"></span>
|
|
{{$.i18n.Tr "repo.pulls.required_status_check_administrator"}}
|
|
</div>
|
|
{{else}}
|
|
<div class="item text green">
|
|
<span class="octicon octicon-check"></span>
|
|
{{$.i18n.Tr "repo.pulls.can_auto_merge_desc"}}
|
|
</div>
|
|
{{end}}
|
|
{{if .AllowMerge}}
|
|
{{$prUnit := .Repository.MustGetUnit $.UnitTypePullRequests}}
|
|
{{$approvers := .Issue.PullRequest.GetApprovers}}
|
|
{{if or $prUnit.PullRequestsConfig.AllowMerge $prUnit.PullRequestsConfig.AllowRebase $prUnit.PullRequestsConfig.AllowRebaseMerge $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"}}">{{$approvers}}</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.AllowRebaseMerge}}
|
|
<div class="ui form rebase-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"}}">{{$approvers}}</textarea>
|
|
</div>
|
|
<button class="ui green button" type="submit" name="do" value="rebase-merge">
|
|
{{$.i18n.Tr "repo.pulls.rebase_merge_commit_pull_request"}}
|
|
</button>
|
|
<button class="ui button merge-cancel">
|
|
{{$.i18n.Tr "cancel"}}
|
|
</button>
|
|
</form>
|
|
</div>
|
|
{{end}}
|
|
{{if $prUnit.PullRequestsConfig.AllowSquash}}
|
|
{{$commitMessages := .Issue.PullRequest.GetCommitMessages}}
|
|
<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"}}">{{$commitMessages}}{{$approvers}}</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 "rebase-merge"}}
|
|
{{$.i18n.Tr "repo.pulls.rebase_merge_commit_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.AllowRebaseMerge}}
|
|
<div class="item{{if eq .MergeStyle "rebase-merge"}} active selected{{end}}" data-do="rebase-merge">{{$.i18n.Tr "repo.pulls.rebase_merge_commit_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}}
|
|
{{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>
|