2019-12-04 01:08:56 +00:00
{{if gt (len .PullReviewers) 0}}
2018-11-22 13:17:36 +00:00
<div class="comment box">
<div class="content">
<div class="ui segment">
<h4>{{$.i18n.Tr "repo.issues.review.reviewers"}}</h4>
2019-12-04 01:08:56 +00:00
{{range .PullReviewers}}
{{ $ createdStr := TimeSinceUnix .UpdatedUnix $.Lang }}
2018-11-22 13:17:36 +00:00
<div class="ui divider"></div>
<div class="review-item">
<span class="type-icon text {{if eq .Type 1}}green
2020-04-03 05:12:42 +00:00
{{- else if eq .Type 2}}grey
{{- else if eq .Type 3}}red
2020-04-06 16:33:34 +00:00
{{- else if eq .Type 4}}yellow
{{else}}grey{{end}}">
{{ $ 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 }}
<a href=" #" class="ui poping up icon re-request-review" data-is-checked="{{if eq .Type 4}}remove{{else}}add{{end}}" data-issue-id="{{$.Issue.ID}}" data-content="{{ if eq .Type 4 }} {{$.i18n.Tr "repo.issues.remove_request_review"}} {{else}} {{$.i18n.Tr "repo.issues.re_request_review"}} {{end}}" data-id="{{.ReviewerID}}" data-update-url="{{$.RepoLink}}/issues/request_review">
{{svg "octicon-sync" 16}}
</a>
{{end}}
2020-02-11 17:02:41 +00:00
{{svg (printf "octicon-%s" .Type.Icon) 16}}
2018-11-22 13:17:36 +00:00
</span>
2020-01-09 01:47:45 +00:00
{{if .Stale}}
<span class="type-icon text grey">
<i class="octicon icon fa-hourglass-end"></i>
</span>
{{end}}
2019-12-04 01:08:56 +00:00
<a class="ui avatar image" href="{{.Reviewer.HomeLink}}">
<img src="{{.Reviewer.RelAvatarLink}}">
2018-11-22 13:17:36 +00:00
</a>
2019-12-04 01:08:56 +00:00
<span class="text grey"><a href="{{.Reviewer.HomeLink}}">{{.Reviewer.Name}}</a>
2018-11-22 13:17:36 +00:00
{{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}}
2020-04-06 16:33:34 +00:00
{{else if eq .Type 4}}
{{$.i18n.Tr "repo.issues.review.wait" $ createdStr | Safe}}
2018-11-22 13:17:36 +00:00
{{else}}
{{$.i18n.Tr "repo.issues.review.comment" $ createdStr | Safe}}
{{end}}
</span>
</div>
{{end}}
</div>
</div>
</div>
{{end}}
2020-04-10 22:01:41 +00:00
<div class="timeline-item comment merge box">
<a class="timeline-avatar text {{if .Issue.PullRequest.HasMerged}}purple
2020-04-03 05:12:42 +00:00
{{- 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
2020-04-17 01:00:36 +00:00
{{- else if .IsBlockedByOutdatedBranch}}red
2020-04-03 05:12:42 +00:00
{{- else if and .EnableStatusCheck (or .RequiredStatusCheckState.IsFailure .RequiredStatusCheckState.IsError)}}red
2020-04-15 20:35:18 +00:00
{{- else if and .EnableStatusCheck (or (not $.LatestCommitStatus) .RequiredStatusCheckState.IsPending .RequiredStatusCheckState.IsWarning)}}yellow
2020-04-19 12:31:56 +00:00
{{- else if and .RequireSigned (not .WillSign)}}red
2020-04-03 05:12:42 +00:00
{{- else if .Issue.PullRequest.IsChecking}}yellow
{{- else if .Issue.PullRequest.CanAutoMerge}}green
{{- else}}red{{end}}">{{svg "octicon-git-merge" 32}}</a>
2017-03-17 05:57:43 +00:00
<div class="content">
2019-06-30 07:57:59 +00:00
{{template "repo/pulls/status" .}}
2020-05-26 02:33:57 +00:00
<div class="ui attached merge-section segment {{if not $.LatestCommitStatus}}no-header{{end}}">
2017-03-17 05:57:43 +00:00
{{if .Issue.PullRequest.HasMerged}}
<div class="item text purple">
2019-09-03 06:29:36 +00:00
{{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}}
2017-03-17 05:57:43 +00:00
</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">
2019-04-20 20:50:34 +00:00
{{if .IsPullRequestBroken}}
{{$.i18n.Tr "repo.pulls.cant_reopen_deleted_branch"}}
{{else}}
{{$.i18n.Tr "repo.pulls.reopen_to_merge"}}
{{end}}
2017-03-17 05:57:43 +00:00
</div>
2020-01-07 17:06:14 +00:00
{{if and .IsPullBranchDeletable ( not .IsPullRequestBroken )}}
2019-04-20 20:50:34 +00:00
<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}}
2019-02-05 11:54:49 +00:00
{{else if .IsPullFilesConflicted}}
<div class="item text grey">
2020-02-11 17:02:41 +00:00
{{svg "octicon-x" 16}}
2019-02-05 11:54:49 +00:00
{{$.i18n.Tr "repo.pulls.files_conflicted"}}
{{range .ConflictedFiles}}
<div>{{.}}</div>
{{end}}
</div>
2018-08-01 03:00:35 +00:00
{{else if .IsPullRequestBroken}}
2017-03-17 05:57:43 +00:00
<div class="item text red">
2020-02-11 17:02:41 +00:00
<i class="icon icon-octicon">{{svg "octicon-x" 16}}</i>
2017-03-17 05:57:43 +00:00
{{$.i18n.Tr "repo.pulls.data_broken"}}
</div>
2018-08-13 19:04:39 +00:00
{{else if .IsPullWorkInProgress}}
<div class="item text grey">
2020-02-11 17:02:41 +00:00
<i class="icon icon-octicon">{{svg "octicon-x" 16}}</i>
2018-08-13 19:04:39 +00:00
{{$.i18n.Tr "repo.pulls.cannot_merge_work_in_progress" .WorkInProgressPrefix | Str2html}}
</div>
2017-03-17 05:57:43 +00:00
{{else if .Issue.PullRequest.IsChecking}}
<div class="item text yellow">
2020-02-11 17:02:41 +00:00
<i class="icon icon-octicon">{{svg "octicon-sync" 16}}</i>
2017-03-17 05:57:43 +00:00
{{$.i18n.Tr "repo.pulls.is_checking"}}
</div>
{{else if .Issue.PullRequest.CanAutoMerge}}
2020-01-11 07:29:34 +00:00
{{if .IsBlockedByApprovals}}
<div class="item text red">
2020-02-11 17:02:41 +00:00
<i class="icon icon-octicon">{{svg "octicon-x" 16}}</i>
2020-01-11 07:29:34 +00:00
{{$.i18n.Tr "repo.pulls.blocked_by_approvals" .GrantedApprovals .Issue.PullRequest.ProtectedBranch.RequiredApprovals}}
</div>
{{else if .IsBlockedByRejection}}
<div class="item text red">
2020-02-11 17:02:41 +00:00
<i class="icon icon-octicon">{{svg "octicon-x" 16}}</i>
2020-01-11 07:29:34 +00:00
{{$.i18n.Tr "repo.pulls.blocked_by_rejection"}}
</div>
2020-04-17 01:00:36 +00:00
{{else if .IsBlockedByOutdatedBranch}}
<div class="item text red">
<i class="icon icon-octicon">{{svg "octicon-x" 16}}</i>
{{$.i18n.Tr "repo.pulls.blocked_by_outdated_branch"}}
</div>
2020-01-22 03:46:04 +00:00
{{else if and .EnableStatusCheck (or .RequiredStatusCheckState.IsError .RequiredStatusCheckState.IsFailure)}}
2020-01-11 07:29:34 +00:00
<div class="item text red">
2020-02-11 17:02:41 +00:00
<i class="icon icon-octicon">{{svg "octicon-x" 16}}</i>
2020-01-11 07:29:34 +00:00
{{$.i18n.Tr "repo.pulls.required_status_check_failed"}}
</div>
2020-04-15 20:35:18 +00:00
{{else if and .EnableStatusCheck (not .RequiredStatusCheckState.IsSuccess)}}
<div class="item text red">
<i class="icon icon-octicon">{{svg "octicon-x" 16}}</i>
{{$.i18n.Tr "repo.pulls.required_status_check_missing"}}
</div>
2020-01-15 08:32:57 +00:00
{{else if and .RequireSigned (not .WillSign)}}
<div class="item text red">
2020-02-11 17:02:41 +00:00
<i class="icon icon-octicon">{{svg "octicon-x" 16}}</i>
2020-01-15 08:32:57 +00:00
{{$.i18n.Tr "repo.pulls.require_signed_wont_sign"}}
</div>
<div class="item text yellow">
2020-01-18 11:30:35 +00:00
<i class="icon unlock"></i>
2020-01-15 08:32:57 +00:00
{{$.i18n.Tr (printf "repo.signing.wont_sign.%s" .WontSignReason) }}
</div>
2019-09-18 05:39:45 +00:00
{{end}}
2020-04-17 01:00:36 +00:00
{{ $ notAllOverridableChecksOk := or .IsBlockedByApprovals .IsBlockedByRejection .IsBlockedByOutdatedBranch (and .EnableStatusCheck (not .RequiredStatusCheckState.IsSuccess))}}
2020-01-16 21:01:22 +00:00
{{if and (or $.IsRepoAdmin (not $ notAllOverridableChecksOk )) (or (not .RequireSigned) .WillSign)}}
{{if $ notAllOverridableChecksOk }}
2019-09-18 05:39:45 +00:00
<div class="item text yellow">
2020-02-11 17:02:41 +00:00
<i class="icon icon-octicon">{{svg "octicon-primitive-dot" 16}}</i>
2019-09-18 05:39:45 +00:00
{{$.i18n.Tr "repo.pulls.required_status_check_administrator"}}
2018-12-27 10:27:08 +00:00
</div>
2019-09-18 05:39:45 +00:00
{{else}}
<div class="item text green">
2020-02-11 17:02:41 +00:00
<i class="icon icon-octicon">{{svg "octicon-check" 16}}</i>
2019-09-18 05:39:45 +00:00
{{$.i18n.Tr "repo.pulls.can_auto_merge_desc"}}
2018-01-05 18:56:50 +00:00
</div>
2019-09-18 05:39:45 +00:00
{{end}}
2020-01-15 08:32:57 +00:00
{{if .WillSign}}
<div class="item text green">
<i class="icon lock green"></i>
{{$.i18n.Tr "repo.signing.will_sign" .SigningKey}}
</div>
2020-01-15 22:55:25 +00:00
{{else if .IsSigned}}
2020-01-18 11:30:35 +00:00
<div class="item text">
<i class="icon unlock"></i>
2020-01-15 08:32:57 +00:00
{{$.i18n.Tr (printf "repo.signing.wont_sign.%s" .WontSignReason) }}
</div>
{{end}}
2019-09-18 05:39:45 +00:00
{{if .AllowMerge}}
{{ $ prUnit := .Repository.MustGetUnit $.UnitTypePullRequests}}
2019-12-30 23:34:11 +00:00
{{ $ approvers := .Issue.PullRequest.GetApprovers}}
2019-09-18 05:39:45 +00:00
{{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">
2020-01-09 14:31:09 +00:00
<textarea name="merge_message_field" rows="5" placeholder="{{$.i18n.Tr "repo.editor.commit_message_desc"}}">Reviewed-on: {{$.Issue.HTMLURL}}& #13;& #10;{{ $ approvers }}</textarea>
2019-09-18 05:39:45 +00:00
</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">
2020-01-09 14:31:09 +00:00
<textarea name="merge_message_field" rows="5" placeholder="{{$.i18n.Tr "repo.editor.commit_message_desc"}}">Reviewed-on: {{$.Issue.HTMLURL}}& #13;& #10;{{ $ approvers }}</textarea>
2019-09-18 05:39:45 +00:00
</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 }}
<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">
2020-04-10 11:26:37 +00:00
<textarea name="merge_message_field" rows="5" placeholder="{{$.i18n.Tr "repo.editor.commit_message_desc"}}">{{.GetCommitMessages}}Reviewed-on: {{$.Issue.HTMLURL}}& #13;& #10;{{ $ approvers }}</textarea>
2019-09-18 05:39:45 +00:00
</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}}
2020-01-16 21:01:22 +00:00
<div class="ui {{if $ notAllOverridableChecksOk }}red{{else}}green{{end}} buttons merge-button">
2019-09-18 05:39:45 +00:00
<button class="ui button" data-do="{{.MergeStyle}}">
2020-02-11 17:02:41 +00:00
{{svg "octicon-git-merge" 16}}
2019-09-18 05:39:45 +00:00
<span class="button-text">
{{if eq .MergeStyle "merge"}}
{{$.i18n.Tr "repo.pulls.merge_pull_request"}}
2018-01-05 18:56:50 +00:00
{{end}}
2019-09-18 05:39:45 +00:00
{{if eq .MergeStyle "rebase"}}
{{$.i18n.Tr "repo.pulls.rebase_merge_pull_request"}}
2018-01-05 18:56:50 +00:00
{{end}}
2019-09-18 05:39:45 +00:00
{{if eq .MergeStyle "rebase-merge"}}
{{$.i18n.Tr "repo.pulls.rebase_merge_commit_pull_request"}}
2018-12-27 10:27:08 +00:00
{{end}}
2019-09-18 05:39:45 +00:00
{{if eq .MergeStyle "squash"}}
{{$.i18n.Tr "repo.pulls.squash_merge_pull_request"}}
2018-01-05 18:56:50 +00:00
{{end}}
2019-09-18 05:39:45 +00:00
</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>
2018-01-05 18:56:50 +00:00
</div>
</div>
2019-09-18 05:39:45 +00:00
{{else}}
<div class="item text red">
2020-02-11 17:02:41 +00:00
{{svg "octicon-x" 16}}
2019-09-18 05:39:45 +00:00
{{$.i18n.Tr "repo.pulls.no_merge_desc"}}
</div>
<div class="item text grey">
2020-02-11 17:02:41 +00:00
{{svg "octicon-info" 16}}
2019-09-18 05:39:45 +00:00
{{$.i18n.Tr "repo.pulls.no_merge_helper"}}
</div>
{{end}}
2020-01-11 07:29:34 +00:00
{{else}}
<div class="item text grey">
2020-02-11 17:02:41 +00:00
{{svg "octicon-info" 16}}
2020-01-11 07:29:34 +00:00
{{$.i18n.Tr "repo.pulls.no_merge_access"}}
</div>
2018-01-05 18:56:50 +00:00
{{end}}
2017-03-17 05:57:43 +00:00
{{end}}
2020-04-14 13:53:34 +00:00
{{if gt .Issue.PullRequest.CommitsBehind 0}}
2020-03-07 01:24:42 +00:00
<div class="ui very compact branch-update grid">
<div class="row">
<div class="item text gray eleven wide left floated column">
<i class="icon icon-octicon">{{svg "octicon-alert" 16}}</i>
{{$.i18n.Tr "repo.pulls.outdated_with_base_branch"}}
</div>
{{if .UpdateAllowed}}
<div class="item text five wide right floated column">
<form action="{{.Link}}/update" method="post">
{{.CsrfTokenHtml}}
<button class="ui button" data-do="update">
<span class="item text">{{$.i18n.Tr "repo.pulls.update_branch"}}</span>
</button>
</form>
</div>
{{end}}
</div>
</div>
{{end}}
2017-03-17 05:57:43 +00:00
{{else}}
2020-01-11 07:29:34 +00:00
{{/* Merge conflict without specific file. Suggest manual merge, only if all reviews and status checks OK. */}}
{{if .IsBlockedByApprovals}}
<div class="item text red">
2020-02-11 17:02:41 +00:00
{{svg "octicon-x" 16}}
2020-01-11 07:29:34 +00:00
{{$.i18n.Tr "repo.pulls.blocked_by_approvals" .GrantedApprovals .Issue.PullRequest.ProtectedBranch.RequiredApprovals}}
</div>
{{else if .IsBlockedByRejection}}
<div class="item text red">
2020-02-11 17:02:41 +00:00
{{svg "octicon-x" 16}}
2020-01-11 07:29:34 +00:00
{{$.i18n.Tr "repo.pulls.blocked_by_rejection"}}
</div>
2020-04-17 01:00:36 +00:00
{{else if .IsBlockedByOutdatedBranch}}
<div class="item text red">
<i class="icon icon-octicon">{{svg "octicon-x" 16}}</i>
{{$.i18n.Tr "repo.pulls.blocked_by_outdated_branch"}}
</div>
2020-04-15 20:35:18 +00:00
{{else if and .EnableStatusCheck (not .RequiredStatusCheckState.IsSuccess)}}
2020-01-11 07:29:34 +00:00
<div class="item text red">
2020-02-11 17:02:41 +00:00
{{svg "octicon-x" 16}}
2020-01-11 07:29:34 +00:00
{{$.i18n.Tr "repo.pulls.required_status_check_failed"}}
</div>
2020-01-15 08:32:57 +00:00
{{else if and .RequireSigned (not .WillSign)}}
<div class="item text red">
2020-02-11 17:02:41 +00:00
{{svg "octicon-x" 16}}
2020-01-15 08:32:57 +00:00
{{$.i18n.Tr "repo.pulls.require_signed_wont_sign"}}
</div>
2020-01-11 07:29:34 +00:00
{{else}}
<div class="item text red">
2020-02-11 17:02:41 +00:00
{{svg "octicon-x" 16}}
2020-01-11 07:29:34 +00:00
{{$.i18n.Tr "repo.pulls.cannot_auto_merge_desc"}}
</div>
<div class="item text grey">
2020-02-11 17:02:41 +00:00
{{svg "octicon-info" 16}}
2020-01-11 07:29:34 +00:00
{{$.i18n.Tr "repo.pulls.cannot_auto_merge_helper"}}
</div>
{{end}}
2017-03-17 05:57:43 +00:00
{{end}}
</div>
</div>
</div>