{{template "repo/issue/branch_selector_field" .}}
+ {{if .Issue.IsPull }}
+
+
+
+
+ {{.i18n.Tr "repo.issues.review.reviewers"}}
+ {{if and .CanChooseReviewer (not .Repository.IsArchived)}}
+ {{svg "octicon-gear" 16}}
+ {{end}}
+
+
+
+
+
+
{{.i18n.Tr "repo.issues.new.no_reviewers"}}
+
+ {{range .PullReviewers}}
+
+
{{.Reviewer.GetDisplayName}}
+
+
+ {{$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}}
+
+
+ {{end}}
+
+
+
+ {{end}}
+
+
+
{{.i18n.Tr "repo.issues.new.labels"}}
diff --git a/templates/user/dashboard/issues.tmpl b/templates/user/dashboard/issues.tmpl
index 447801d84936..780c8c125707 100644
--- a/templates/user/dashboard/issues.tmpl
+++ b/templates/user/dashboard/issues.tmpl
@@ -173,14 +173,25 @@
{{if .IsPull}}
{{$approveOfficial := call $approvalCounts .ID "approve"}}
{{$rejectOfficial := call $approvalCounts .ID "reject"}}
- {{if or (gt $approveOfficial 0) (gt $rejectOfficial 0) }}
+ {{$waitingOfficial := call $approvalCounts .ID "waiting"}}
+ {{if gt $approveOfficial 0}}
{{svg "octicon-check" 16}}
{{$.i18n.Tr (TrN $.i18n.Lang $approveOfficial "repo.pulls.approve_count_1" "repo.pulls.approve_count_n") $approveOfficial}}
- {{if or (gt $rejectOfficial 0)}}
- {{svg "octicon-x" 16}}
- {{$.i18n.Tr (TrN $.i18n.Lang $rejectOfficial "repo.pulls.reject_count_1" "repo.pulls.reject_count_n") $rejectOfficial}}
- {{end}}
+
+ {{end}}
+
+ {{if gt $rejectOfficial 0}}
+ {{svg "octicon-request-changes" 16}}
+ {{$.i18n.Tr (TrN $.i18n.Lang $rejectOfficial "repo.pulls.reject_count_1" "repo.pulls.reject_count_n") $rejectOfficial}}
+
{{end}}
+
+ {{if gt $waitingOfficial 0}}
+ {{svg "octicon-eye" 16}}
+ {{$.i18n.Tr (TrN $.i18n.Lang $waitingOfficial "repo.pulls.waiting_count_1" "repo.pulls.waiting_count_n") $waitingOfficial}}
+
+ {{end}}
+
{{if and (not .PullRequest.HasMerged) (gt (len .PullRequest.ConflictedFiles) 0)}}
{{svg "octicon-mirror" 16}} {{$.i18n.Tr (TrN $.i18n.Lang (len .PullRequest.ConflictedFiles) "repo.pulls.num_conflicting_files_1" "repo.pulls.num_conflicting_files_n") (len .PullRequest.ConflictedFiles)}}
{{end}}
diff --git a/web_src/js/index.js b/web_src/js/index.js
index a0e410c133e9..93b27483be11 100644
--- a/web_src/js/index.js
+++ b/web_src/js/index.js
@@ -158,7 +158,7 @@ function initLabelEdit() {
});
}
-function updateIssuesMeta(url, action, issueIds, elementId) {
+function updateIssuesMeta(url, action, issueIds, elementId, isAdd) {
return new Promise(((resolve) => {
$.ajax({
type: 'POST',
@@ -167,7 +167,8 @@ function updateIssuesMeta(url, action, issueIds, elementId) {
_csrf: csrf,
action,
issue_ids: issueIds,
- id: elementId
+ id: elementId,
+ is_add: isAdd
},
success: resolve
});
@@ -390,7 +391,8 @@ function initCommentForm() {
label['update-url'],
label.action,
label['issue-id'],
- elementId
+ elementId,
+ label['is-checked']
);
promises.push(promise);
});
@@ -400,22 +402,30 @@ function initCommentForm() {
$listMenu.find('.item:not(.no-select)').click(function () {
// we don't need the action attribute when updating assignees
- if (selector === 'select-assignees-modify') {
+ if (selector === 'select-assignees-modify' || selector === 'select-reviewers-modify') {
// UI magic. We need to do this here, otherwise it would destroy the functionality of
// adding/removing labels
+
+ if ($(this).data('can-change') === 'block') {
+ return false;
+ }
+
if ($(this).hasClass('checked')) {
$(this).removeClass('checked');
$(this).find('.octicon-check').addClass('invisible');
+ $(this).data('is-checked', 'remove');
} else {
$(this).addClass('checked');
$(this).find('.octicon-check').removeClass('invisible');
+ $(this).data('is-checked', 'add');
}
updateIssuesMeta(
$listMenu.data('update-url'),
'',
$listMenu.data('issue-id'),
- $(this).data('id')
+ $(this).data('id'),
+ $(this).data('is-checked')
);
$listMenu.data('action', 'update'); // Update to reload the page when we updated items
return false;
@@ -474,6 +484,7 @@ function initCommentForm() {
$listMenu.data('update-url'),
'clear',
$listMenu.data('issue-id'),
+ '',
''
).then(reload);
}
@@ -481,6 +492,7 @@ function initCommentForm() {
$(this).parent().find('.item').each(function () {
$(this).removeClass('checked');
$(this).find('.octicon').addClass('invisible');
+ $(this).data('is-checked', 'remove');
});
$list.find('.item').each(function () {
@@ -495,6 +507,7 @@ function initCommentForm() {
initListSubmits('select-label', 'labels');
initListSubmits('select-assignees', 'assignees');
initListSubmits('select-assignees-modify', 'assignees');
+ initListSubmits('select-reviewers-modify', 'assignees');
function selectItem(select_id, input_id) {
const $menu = $(`${select_id} .menu`);
@@ -512,7 +525,8 @@ function initCommentForm() {
$menu.data('update-url'),
'',
$menu.data('issue-id'),
- $(this).data('id')
+ $(this).data('id'),
+ $(this).data('is-checked')
).then(reload);
}
switch (input_id) {
@@ -538,7 +552,8 @@ function initCommentForm() {
$menu.data('update-url'),
'',
$menu.data('issue-id'),
- $(this).data('id')
+ $(this).data('id'),
+ $(this).data('is-checked')
).then(reload);
}
@@ -648,6 +663,18 @@ function initInstall() {
function initIssueComments() {
if ($('.repository.view.issue .comments').length === 0) return;
+ $('.re-request-review').click((event) => {
+ const $this = $('.re-request-review');
+ event.preventDefault();
+ updateIssuesMeta(
+ $this.data('update-url'),
+ '',
+ $this.data('issue-id'),
+ $this.data('id'),
+ $this.data('is-checked')
+ ).then(reload);
+ });
+
$(document).click((event) => {
const urlTarget = $(':target');
if (urlTarget.length === 0) return;
@@ -2516,7 +2543,7 @@ $(document).ready(async () => {
elementId = '';
action = 'clear';
}
- updateIssuesMeta(url, action, issueIDs, elementId).then(() => {
+ updateIssuesMeta(url, action, issueIDs, elementId, '').then(() => {
// NOTICE: This reset of checkbox state targets Firefox caching behaviour, as the checkboxes stay checked after reload
if (action === 'close' || action === 'open') {
// uncheck all checkboxes