diff options
author | Jacob Schatz <jschatz@gitlab.com> | 2016-06-13 18:57:38 +0300 |
---|---|---|
committer | Jacob Schatz <jschatz@gitlab.com> | 2016-06-13 18:57:38 +0300 |
commit | 70672182d1e28ad0aea4339921f54044a3a83cb6 (patch) | |
tree | 43fa26dade0466c7cd835bb9f54ba33a3f0db8f4 /app/assets/javascripts | |
parent | 9fdadfc065d52926d7fdd0f675c6f5335044aa22 (diff) | |
parent | 952660d2cf9b2e25b2014d117cce3bf4c93d6818 (diff) |
Merge branch 'fix-bulk-assign-labels' into 'master'
Fixes bulk-assign label for multiple issues not having the same labels
## What does this MR do?
Fixes a bug when bulk-assigning a label to multiple issues while the label is present in on the issues on the selection.
## Screenshots (if relevant)
**Before Bugfix**
<img src="/uploads/ad1f290bcf3930177a3a71c69cbe5325/before-bugfix.gif" width="700"/>
**After Bugfix**
<img src="/uploads/1f04d6bf027806fb13ca3773febda744/bugfix.gif" width="700"/>
## Does this MR meet the acceptance criteria?
- [x] Tests
- [x] Added for this feature/bug
- [x] All builds are passing
- [x] Branch has no merge conflicts with `master` (if you do - rebase it please)
See merge request !4602
Diffstat (limited to 'app/assets/javascripts')
-rw-r--r-- | app/assets/javascripts/issues-bulk-assignment.js.coffee | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/app/assets/javascripts/issues-bulk-assignment.js.coffee b/app/assets/javascripts/issues-bulk-assignment.js.coffee index 16d023dd391..9dc3529a17f 100644 --- a/app/assets/javascripts/issues-bulk-assignment.js.coffee +++ b/app/assets/javascripts/issues-bulk-assignment.js.coffee @@ -97,13 +97,22 @@ class @IssuableBulkActions $labels = @form.find('.labels-filter input[name="update[label_ids][]"]') $labels.each (k, label) -> - labelIds.push $(label).val() if label + labelIds.push parseInt($(label).val()) if label labelIds ###* - * Just an alias of @getUnmarkedIndeterminedLabels - * @return {Array} Array of labels + * Returns Label IDs that will be removed from issue selection + * @return {Array} Array of labels IDs ### getLabelsToRemove: -> - @getUnmarkedIndeterminedLabels() + result = [] + indeterminatedLabels = @getUnmarkedIndeterminedLabels() + labelsToApply = @getLabelsToApply() + + indeterminatedLabels.map (id) -> + # We need to exclude label IDs that will be applied + # By not doing this will cause issues from selection to not add labels at all + result.push(id) if labelsToApply.indexOf(id) is -1 + + result |