@@ -3,9 +3,8 @@ import {updateIssuesMeta} from './repo-issue.js';
33import { toggleElem } from '../utils/dom.js' ;
44
55export function initCommonIssue ( ) {
6- const $issueSelectAllWrapper = $ ( '.issue-checkbox-all' ) ;
7- const $issueSelectAll = $ ( '.issue-checkbox-all input' ) ;
8- const $issueCheckboxes = $ ( '.issue-checkbox input' ) ;
6+ const $issueSelectAll = $ ( '.issue-checkbox-all' ) ;
7+ const $issueCheckboxes = $ ( '.issue-checkbox' ) ;
98
109 const syncIssueSelectionState = ( ) => {
1110 const $checked = $issueCheckboxes . filter ( ':checked' ) ;
@@ -23,7 +22,7 @@ export function initCommonIssue() {
2322 toggleElem ( $ ( '#issue-filters' ) , ! anyChecked ) ;
2423 toggleElem ( $ ( '#issue-actions' ) , anyChecked ) ;
2524 // there are two panels but only one select-all checkbox, so move the checkbox to the visible panel
26- $ ( '#issue-filters, #issue-actions' ) . filter ( ':visible' ) . find ( '.column:first' ) . prepend ( $issueSelectAllWrapper ) ;
25+ $ ( '#issue-filters, #issue-actions' ) . filter ( ':visible' ) . find ( '.column:first' ) . prepend ( $issueSelectAll ) ;
2726 } ;
2827
2928 $issueCheckboxes . on ( 'change' , syncIssueSelectionState ) ;
@@ -38,7 +37,7 @@ export function initCommonIssue() {
3837 let action = this . getAttribute ( 'data-action' ) ;
3938 let elementId = this . getAttribute ( 'data-element-id' ) ;
4039 const url = this . getAttribute ( 'data-url' ) ;
41- const issueIDs = $ ( '.issue-checkbox' ) . children ( 'input :checked') . map ( ( _ , el ) => {
40+ const issueIDs = $ ( '.issue-checkbox:checked' ) . map ( ( _ , el ) => {
4241 return el . getAttribute ( 'data-issue-id' ) ;
4342 } ) . get ( ) . join ( ',' ) ;
4443 if ( elementId === '0' && url . slice ( - 9 ) === '/assignee' ) {
@@ -54,20 +53,7 @@ export function initCommonIssue() {
5453 issueIDs ,
5554 elementId
5655 ) . then ( ( ) => {
57- // NOTICE: This reset of checkbox state targets Firefox caching behaviour, as the
58- // checkboxes stay checked after reload
59- if ( action === 'close' || action === 'open' ) {
60- // uncheck all checkboxes
61- $ ( '.issue-checkbox input[type="checkbox"]' ) . each ( ( _ , e ) => { e . checked = false } ) ;
62- }
6356 window . location . reload ( ) ;
6457 } ) ;
6558 } ) ;
66-
67- // NOTICE: This event trigger targets Firefox caching behaviour, as the checkboxes stay
68- // checked after reload trigger checked event, if checkboxes are checked on load
69- $ ( '.issue-checkbox input[type="checkbox"]:checked' ) . first ( ) . each ( ( _ , e ) => {
70- e . checked = false ;
71- $ ( e ) . trigger ( 'click' ) ;
72- } ) ;
7359}
0 commit comments