{{if or .PullReviewers .OriginalReviews }}

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

{{range .PullReviewers}} {{ $createdStr:= TimeSinceUnix .Review.UpdatedUnix $.i18n.Lang }}
{{if .User}} {{avatar .User}} {{end}} {{if .User}} {{.User.GetDisplayName}} {{else if .Team}} {{$.Issue.Repo.OwnerName}}/{{.Team.Name}} {{end}} {{if eq .Review.Type 1}} {{$.i18n.Tr "repo.issues.review.approve" $createdStr | Safe}} {{else if eq .Review.Type 2}} {{$.i18n.Tr "repo.issues.review.comment" $createdStr | Safe}} {{else if eq .Review.Type 3}} {{$.i18n.Tr "repo.issues.review.reject" $createdStr | Safe}} {{else if eq .Review.Type 4}} {{$.i18n.Tr "repo.issues.review.wait" $createdStr | Safe}} {{else}} {{$.i18n.Tr "repo.issues.review.comment" $createdStr | Safe}} {{end}}
{{if .Review.Stale}} {{svg "octicon-hourglass" 16 "icon"}} {{end}} {{if (and $.Permission.IsAdmin (or (eq .Review.Type 1) (eq .Review.Type 3)) (not $.Issue.IsClosed))}} {{svg "octicon-x" 16}} {{end}} {{if .CanChange }} {{if .Checked}} {{svg "octicon-trash"}} {{else}} {{svg "octicon-sync"}} {{end}} {{end}} {{svg (printf "octicon-%s" .Review.Type.Icon)}}
{{end}} {{range .OriginalReviews}} {{ $createdStr:= TimeSinceUnix .UpdatedUnix $.i18n.Lang }}
{{end}}
{{end}}
{{svg "octicon-git-merge" 32}}
{{template "repo/pulls/status" .}} {{$canAutoMerge := false}}
{{if .Issue.PullRequest.HasMerged}}
{{if .Issue.PullRequest.MergedCommitID}} {{$link := printf "%s/commit/%s" $.Repository.HTMLURL (.Issue.PullRequest.MergedCommitID|PathEscape)}} {{if eq $.Issue.PullRequest.Status 3}} {{$.i18n.Tr "repo.pulls.manually_merged_as" ($link|Escape) (ShortSha .Issue.PullRequest.MergedCommitID) | Safe}} {{else}} {{$.i18n.Tr "repo.pulls.merged_as" ($link|Escape) (ShortSha .Issue.PullRequest.MergedCommitID) | Safe}} {{end}} {{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"}} {{$.i18n.Tr "repo.pulls.files_conflicted"}} {{range .ConflictedFiles}}
{{.}}
{{end}}
{{else if .IsPullRequestBroken}}
{{svg "octicon-x"}} {{$.i18n.Tr "repo.pulls.data_broken"}}
{{else if .IsPullWorkInProgress}}
{{svg "octicon-x"}} {{$.i18n.Tr "repo.pulls.cannot_merge_work_in_progress" }}
{{if or .HasIssuesOrPullsWritePermission .IsIssuePoster}} {{end}}
{{else if .Issue.PullRequest.IsChecking}}
{{svg "octicon-sync"}} {{$.i18n.Tr "repo.pulls.is_checking"}}
{{else if .Issue.PullRequest.IsAncestor}}
{{svg "octicon-alert" 16}} {{$.i18n.Tr "repo.pulls.is_ancestor"}}
{{else if or .Issue.PullRequest.CanAutoMerge .Issue.PullRequest.IsEmpty}} {{if .IsBlockedByApprovals}}
{{svg "octicon-x"}} {{$.i18n.Tr "repo.pulls.blocked_by_approvals" .GrantedApprovals .Issue.PullRequest.ProtectedBranch.RequiredApprovals}}
{{else if .IsBlockedByRejection}}
{{svg "octicon-x"}} {{$.i18n.Tr "repo.pulls.blocked_by_rejection"}}
{{else if .IsBlockedByOfficialReviewRequests}}
{{svg "octicon-x"}} {{$.i18n.Tr "repo.pulls.blocked_by_official_review_requests"}}
{{else if .IsBlockedByOutdatedBranch}}
{{svg "octicon-x"}} {{$.i18n.Tr "repo.pulls.blocked_by_outdated_branch"}}
{{else if .IsBlockedByChangedProtectedFiles}}
{{svg "octicon-x" 16}} {{$.i18n.TrN $.ChangedProtectedFilesNum "repo.pulls.blocked_by_changed_protected_files_1" "repo.pulls.blocked_by_changed_protected_files_n" | Safe }}
{{range .ChangedProtectedFiles}}
{{.}}
{{end}}
{{else if and .EnableStatusCheck (or .RequiredStatusCheckState.IsError .RequiredStatusCheckState.IsFailure)}}
{{svg "octicon-x"}} {{$.i18n.Tr "repo.pulls.required_status_check_failed"}}
{{else if and .EnableStatusCheck (not .RequiredStatusCheckState.IsSuccess)}}
{{svg "octicon-x"}} {{$.i18n.Tr "repo.pulls.required_status_check_missing"}}
{{else if and .AllowMerge .RequireSigned (not .WillSign)}}
{{svg "octicon-x"}} {{$.i18n.Tr "repo.pulls.require_signed_wont_sign"}}
{{$.i18n.Tr (printf "repo.signing.wont_sign.%s" .WontSignReason) }}
{{end}} {{$notAllOverridableChecksOk := or .IsBlockedByApprovals .IsBlockedByRejection .IsBlockedByOfficialReviewRequests .IsBlockedByOutdatedBranch .IsBlockedByChangedProtectedFiles (and .EnableStatusCheck (not .RequiredStatusCheckState.IsSuccess))}} {{/* admin can merge without checks, writer can merge when checkes succeed */}} {{$canMergeNow := and (or $.IsRepoAdmin (not $notAllOverridableChecksOk)) (or (not .AllowMerge) (not .RequireSigned) .WillSign)}} {{/* admin and writer both can make an auto merge schedule */}} {{if $canMergeNow}} {{if $notAllOverridableChecksOk}}
{{svg "octicon-dot-fill"}} {{$.i18n.Tr "repo.pulls.required_status_check_administrator"}}
{{else}}
{{svg "octicon-check"}} {{$.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}} {{end}} {{if and (gt .Issue.PullRequest.CommitsBehind 0) (not .Issue.IsClosed) (not .Issue.PullRequest.IsChecking) (not .IsPullFilesConflicted) (not .IsPullRequestBroken) (not $canAutoMerge)}}
{{svg "octicon-alert"}} {{$.i18n.Tr "repo.pulls.outdated_with_base_branch"}}
{{if and .UpdateAllowed .UpdateByRebaseAllowed }}
{{end}} {{if and .UpdateAllowed (not .UpdateByRebaseAllowed)}}
{{.CsrfTokenHtml}}
{{end}}
{{end}} {{if .Issue.PullRequest.IsEmpty}}
{{svg "octicon-alert" 16}} {{$.i18n.Tr "repo.pulls.is_empty"}}
{{end}} {{if .AllowMerge}} {{/* user is allowed to merge */}} {{$prUnit := .Repository.MustGetUnit $.UnitTypePullRequests}} {{$approvers := .Issue.PullRequest.GetApprovers}} {{if or $prUnit.PullRequestsConfig.AllowMerge $prUnit.PullRequestsConfig.AllowRebase $prUnit.PullRequestsConfig.AllowRebaseMerge $prUnit.PullRequestsConfig.AllowSquash}} {{$hasPendingPullRequestMergeTip := ""}} {{if .HasPendingPullRequestMerge}} {{$createdPRMergeStr := TimeSinceUnix .PendingPullRequestMerge.CreatedUnix $.i18n.Lang}} {{$hasPendingPullRequestMergeTip = $.i18n.Tr "repo.pulls.auto_merge_has_pending_schedule" .PendingPullRequestMerge.Doer.Name $createdPRMergeStr}} {{end}}
{{if .ShowMergeInstructions}} {{template "repo/issue/view_content/pull_merge_instruction" (dict "i18n" .i18n "Issue" .Issue)}} {{end}} {{else}} {{/* no merge style was set in repo setting: not or ($prUnit.PullRequestsConfig.AllowMerge ...) */}}
{{svg "octicon-x"}} {{$.i18n.Tr "repo.pulls.no_merge_desc"}}
{{svg "octicon-info"}} {{$.i18n.Tr "repo.pulls.no_merge_helper"}}
{{end}} {{/* end if the repo was set to use any merge style */}} {{else}} {{/* user is not allowed to merge */}}
{{svg "octicon-info"}} {{$.i18n.Tr "repo.pulls.no_merge_access"}}
{{end}} {{/* end if user is allowed to merge or not */}} {{else}} {{/* Merge conflict without specific file. Suggest manual merge, only if all reviews and status checks OK. */}} {{if .IsBlockedByApprovals}}
{{svg "octicon-x"}} {{$.i18n.Tr "repo.pulls.blocked_by_approvals" .GrantedApprovals .Issue.PullRequest.ProtectedBranch.RequiredApprovals}}
{{else if .IsBlockedByRejection}}
{{svg "octicon-x"}} {{$.i18n.Tr "repo.pulls.blocked_by_rejection"}}
{{else if .IsBlockedByOfficialReviewRequests}}
{{svg "octicon-x"}} {{$.i18n.Tr "repo.pulls.blocked_by_official_review_requests"}}
{{else if .IsBlockedByOutdatedBranch}}
{{svg "octicon-x"}} {{$.i18n.Tr "repo.pulls.blocked_by_outdated_branch"}}
{{else if .IsBlockedByChangedProtectedFiles}}
{{svg "octicon-x" 16}} {{$.i18n.TrN $.ChangedProtectedFilesNum "repo.pulls.blocked_by_changed_protected_files_1" "repo.pulls.blocked_by_changed_protected_files_n" | Safe }}
{{range .ChangedProtectedFiles}}
{{.}}
{{end}}
{{else if and .EnableStatusCheck (not .RequiredStatusCheckState.IsSuccess)}}
{{svg "octicon-x"}} {{$.i18n.Tr "repo.pulls.required_status_check_failed"}}
{{else if and .RequireSigned (not .WillSign)}}
{{svg "octicon-x"}} {{$.i18n.Tr "repo.pulls.require_signed_wont_sign"}}
{{else}}
{{svg "octicon-x"}} {{$.i18n.Tr "repo.pulls.cannot_auto_merge_desc"}}
{{svg "octicon-info"}} {{$.i18n.Tr "repo.pulls.cannot_auto_merge_helper"}}
{{end}} {{end}} {{if $.StillCanManualMerge}}
{{end}}