diff --git a/web_src/js/index.js b/web_src/js/index.js index edde96054..679409b90 100755 --- a/web_src/js/index.js +++ b/web_src/js/index.js @@ -231,7 +231,7 @@ function initLabelEdit() { }); } -function updateIssuesMeta(url, action, issueIds, elementId, isAdd,ref_b) { +function updateIssuesMeta_new(url, action, issueIds, elementId, isAdd,ref_b) { return new Promise((resolve) => { $.ajax({ type: 'POST', @@ -249,6 +249,24 @@ function updateIssuesMeta(url, action, issueIds, elementId, isAdd,ref_b) { }); } +function updateIssuesMeta(url, action, issueIds, elementId) { + return new Promise((resolve) => { + $.ajax({ + type: 'POST', + url, + data: { + _csrf: csrf, + action, + issue_ids: issueIds, + id: elementId, + is_add: isAdd, + }, + success: resolve + }); + }); +} + + function initRepoStatusChecker() { const migrating = $('#repo_migrating'); $('#repo_migrating_failed').hide(); @@ -495,7 +513,6 @@ function initCommentForm() { label['issue-id'], elementId, label['is-checked'], - '' ); promises.push(promise); }); @@ -531,7 +548,7 @@ function initCommentForm() { } console.log("$(this)",$(this)) console.log("$listMenu",$listMenu) - const isRef = ''; + //const isRef = ''; // if ($listMenu.data('update-url').includes("ref")){ // isRef = $(this).data('data-name'); // } @@ -541,7 +558,6 @@ function initCommentForm() { $listMenu.data('issue-id'), $(this).data('id'), $(this).data('is-checked'), - '' ); $listMenu.data('action', 'update'); // Update to reload the page when we updated items return false; @@ -612,8 +628,8 @@ function initCommentForm() { 'clear', $listMenu.data('issue-id'), '', - '', - '', + '' + ).then(reload); } @@ -670,10 +686,9 @@ function initCommentForm() { let ref = '' if (select_id=='.select-branch'){ ref = $(this).data('name'); - console.log("ref:",ref) } - console.log("ref:",ref) - updateIssuesMeta( + + updateIssuesMeta_new( $menu.data('update-url'), '', $menu.data('issue-id'), @@ -719,8 +734,7 @@ function initCommentForm() { '', $menu.data('issue-id'), $(this).data('id'), - $(this).data('is-checked'), - '' + $(this).data('is-checked') ).then(reload); } @@ -733,7 +747,7 @@ function initCommentForm() { // Milestone and assignee selectItem('.select-milestone', '#milestone_id'); selectItem('.select-assignee', '#assignee_id'); - selectItem('.select-branch', ''); + //selectItem('.select-branch', ''); } function initInstall() { @@ -836,9 +850,9 @@ function initIssueComments() { const issueId = $(this).data('issue-id'); const id = $(this).data('id'); const isChecked = $(this).data('is-checked'); - const ref = $(this).data('name'); + //const ref = $(this).data('name'); event.preventDefault(); - updateIssuesMeta(url, '', issueId, id, isChecked,ref).then(reload); + updateIssuesMeta(url, '', issueId, id, isChecked).then(reload); }); $(document).on('click', (event) => { @@ -2926,12 +2940,12 @@ $(document).ready(async () => { .get() .join(); console.log("this:",this) - + const {url} = this.dataset; if (elementId === '0' && url.substr(-9) === '/assignee') { 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