mirror of
				https://github.com/go-gitea/gitea
				synced 2025-10-31 19:38:23 +00:00 
			
		
		
		
	add request review from specific reviewers feature in pull request (#10756)
* add request review feature in pull request add a way to notify specific reviewers to review like github , by add or delet a special type review . The acton is is similar to Assign , so many code reuse the function and items of Assignee, but the meaning and result is different. The Permission style is is similar to github, that only writer can add a review request from Reviewers, but the poster can recall and remove a review request after a reviwer has revied even if he don't have Write Premission. only manager , the poster and reviewer of a request review can remove it. The reviewers can be requested to review contain all readers for private repo , for public, contain all writers and watchers. The offical Review Request will block merge if Reject can block it. an other change: add ui otify for Assignees. Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com> Co-authored-by: Lauris BH <lauris@nix.lv> Signed-off-by: a1012112796 <1012112796@qq.com> * new change * add placeholder string * do some changes follow #10238 to add review requests num on lists also change icon for review requests to eye Co-authored-by: Lauris BH <lauris@nix.lv>
This commit is contained in:
		| @@ -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 | ||||
|   | ||||
		Reference in New Issue
	
	Block a user