{{if gt (len .PullReviewers) 0}}

{{$.i18n.Tr "repo.issues.review.reviewers"}}

{{range .PullReviewers}} {{ $createdStr:= TimeSinceUnix .UpdatedUnix $.Lang }}
{{$canChoose := false}} {{if eq .Type 4}} {{if or (eq .ReviewerID $.SignedUserID) $.Permission.IsAdmin}} {{$canChoose = true}} {{end}} {{else}} {{if and (or $.IsIssuePoster $.CanChooseReviewer) (not (eq $.SignedUserID .ReviewerID))}} {{$canChoose = true}} {{end}} {{end}} {{if $canChoose }} {{svg "octicon-sync" 16}} {{end}} {{svg (printf "octicon-%s" .Type.Icon) 16}} {{if .Stale}} {{end}} {{.Reviewer.Name}} {{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 if eq .Type 4}} {{$.i18n.Tr "repo.issues.review.wait" $createdStr | Safe}} {{else}} {{$.i18n.Tr "repo.issues.review.comment" $createdStr | Safe}} {{end}}
{{end}}
{{end}}
{{svg "octicon-git-merge" 32}}
{{template "repo/pulls/status" .}}
{{if .Issue.PullRequest.HasMerged}}
{{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}}
{{if .IsPullBranchDeletable}}
{{$.i18n.Tr "repo.branch.delete" .HeadTarget}}
{{end}} {{else if .Issue.IsClosed}}
{{if .IsPullRequestBroken}} {{$.i18n.Tr "repo.pulls.cant_reopen_deleted_branch"}} {{else}} {{$.i18n.Tr "repo.pulls.reopen_to_merge"}} {{end}}
{{if and .IsPullBranchDeletable ( not .IsPullRequestBroken )}}
{{$.i18n.Tr "repo.branch.delete" .HeadTarget}}
{{end}} {{else if .IsPullFilesConflicted}}
{{svg "octicon-x" 16}} {{$.i18n.Tr "repo.pulls.files_conflicted"}} {{range .ConflictedFiles}}
{{.}}
{{end}}
{{else if .IsPullRequestBroken}}
{{svg "octicon-x" 16}} {{$.i18n.Tr "repo.pulls.data_broken"}}
{{else if .IsPullWorkInProgress}}
{{svg "octicon-x" 16}} {{$.i18n.Tr "repo.pulls.cannot_merge_work_in_progress" (.WorkInProgressPrefix|Escape) | Str2html}}
{{else if .Issue.PullRequest.IsChecking}}
{{svg "octicon-sync" 16}} {{$.i18n.Tr "repo.pulls.is_checking"}}
{{else if .Issue.PullRequest.CanAutoMerge}} {{if .IsBlockedByApprovals}}
{{svg "octicon-x" 16}} {{$.i18n.Tr "repo.pulls.blocked_by_approvals" .GrantedApprovals .Issue.PullRequest.ProtectedBranch.RequiredApprovals}}
{{else if .IsBlockedByRejection}}
{{svg "octicon-x" 16}} {{$.i18n.Tr "repo.pulls.blocked_by_rejection"}}
{{else if .IsBlockedByOutdatedBranch}}
{{svg "octicon-x" 16}} {{$.i18n.Tr "repo.pulls.blocked_by_outdated_branch"}}
{{else if and .EnableStatusCheck (or .RequiredStatusCheckState.IsError .RequiredStatusCheckState.IsFailure)}}
{{svg "octicon-x" 16}} {{$.i18n.Tr "repo.pulls.required_status_check_failed"}}
{{else if and .EnableStatusCheck (not .RequiredStatusCheckState.IsSuccess)}}
{{svg "octicon-x" 16}} {{$.i18n.Tr "repo.pulls.required_status_check_missing"}}
{{else if and .RequireSigned (not .WillSign)}}
{{svg "octicon-x" 16}} {{$.i18n.Tr "repo.pulls.require_signed_wont_sign"}}
{{$.i18n.Tr (printf "repo.signing.wont_sign.%s" .WontSignReason) }}
{{end}} {{$notAllOverridableChecksOk := or .IsBlockedByApprovals .IsBlockedByRejection .IsBlockedByOutdatedBranch (and .EnableStatusCheck (not .RequiredStatusCheckState.IsSuccess))}} {{if and (or $.IsRepoAdmin (not $notAllOverridableChecksOk)) (or (not .RequireSigned) .WillSign)}} {{if $notAllOverridableChecksOk}}
{{svg "octicon-primitive-dot" 16}} {{$.i18n.Tr "repo.pulls.required_status_check_administrator"}}
{{else}}
{{svg "octicon-check" 16}} {{$.i18n.Tr "repo.pulls.can_auto_merge_desc"}}
{{end}} {{if .WillSign}}
{{$.i18n.Tr "repo.signing.will_sign" .SigningKey}}
{{else if .IsSigned}}
{{$.i18n.Tr (printf "repo.signing.wont_sign.%s" .WontSignReason) }}
{{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}}
{{if $prUnit.PullRequestsConfig.AllowMerge}} {{end}} {{if $prUnit.PullRequestsConfig.AllowRebase}} {{end}} {{if $prUnit.PullRequestsConfig.AllowRebaseMerge}} {{end}} {{if $prUnit.PullRequestsConfig.AllowSquash}} {{end}}
{{else}}
{{svg "octicon-x" 16}} {{$.i18n.Tr "repo.pulls.no_merge_desc"}}
{{svg "octicon-info" 16}} {{$.i18n.Tr "repo.pulls.no_merge_helper"}}
{{end}} {{else}}
{{svg "octicon-info" 16}} {{$.i18n.Tr "repo.pulls.no_merge_access"}}
{{end}} {{end}} {{if gt .Issue.PullRequest.CommitsBehind 0}}
{{svg "octicon-alert" 16}} {{$.i18n.Tr "repo.pulls.outdated_with_base_branch"}}
{{if .UpdateAllowed}}
{{.CsrfTokenHtml}}
{{end}}
{{end}} {{else}} {{/* Merge conflict without specific file. Suggest manual merge, only if all reviews and status checks OK. */}} {{if .IsBlockedByApprovals}}
{{svg "octicon-x" 16}} {{$.i18n.Tr "repo.pulls.blocked_by_approvals" .GrantedApprovals .Issue.PullRequest.ProtectedBranch.RequiredApprovals}}
{{else if .IsBlockedByRejection}}
{{svg "octicon-x" 16}} {{$.i18n.Tr "repo.pulls.blocked_by_rejection"}}
{{else if .IsBlockedByOutdatedBranch}}
{{svg "octicon-x" 16}} {{$.i18n.Tr "repo.pulls.blocked_by_outdated_branch"}}
{{else if and .EnableStatusCheck (not .RequiredStatusCheckState.IsSuccess)}}
{{svg "octicon-x" 16}} {{$.i18n.Tr "repo.pulls.required_status_check_failed"}}
{{else if and .RequireSigned (not .WillSign)}}
{{svg "octicon-x" 16}} {{$.i18n.Tr "repo.pulls.require_signed_wont_sign"}}
{{else}}
{{svg "octicon-x" 16}} {{$.i18n.Tr "repo.pulls.cannot_auto_merge_desc"}}
{{svg "octicon-info" 16}} {{$.i18n.Tr "repo.pulls.cannot_auto_merge_helper"}}
{{end}} {{end}}