Commit aad8ab01 authored by Phil Hughes's avatar Phil Hughes

Merge branch '229625-follow-up-from-fix-bulk-editing-of-labels-not-working-correctly' into 'master'

Improve labels_select.js code

Closes #229625

See merge request gitlab-org/gitlab!37225
parents 0e3758d3 9d918828
......@@ -3,7 +3,7 @@
/* global ListLabel */
import $ from 'jquery';
import { difference, isEqual, escape, sortBy, template } from 'lodash';
import { difference, isEqual, escape, sortBy, template, union } from 'lodash';
import { sprintf, s__, __ } from './locale';
import axios from './lib/utils/axios_utils';
import IssuableBulkUpdateActions from './issuable_bulk_update_actions';
......@@ -560,15 +560,15 @@ export default class LabelsSelect {
IssuableBulkUpdateActions.willUpdateLabels = true;
}
// eslint-disable-next-line class-methods-use-this
setDropdownData($dropdown, isChecking, labelId) {
setDropdownData($dropdown, isMarking, labelId) {
let userCheckedIds = $dropdown.data('user-checked') || [];
let userUncheckedIds = $dropdown.data('user-unchecked') || [];
if (isChecking) {
userCheckedIds = userCheckedIds.concat(labelId);
if (isMarking) {
userCheckedIds = union(userCheckedIds, [labelId]);
userUncheckedIds = difference(userUncheckedIds, [labelId]);
} else {
userUncheckedIds = userUncheckedIds.concat(labelId);
userUncheckedIds = union(userUncheckedIds, [labelId]);
userCheckedIds = difference(userCheckedIds, [labelId]);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment