diff options
author | Alfredo Sumaran <alfredo@gitlab.com> | 2016-06-10 12:40:54 -0500 |
---|---|---|
committer | Alfredo Sumaran <alfredo@gitlab.com> | 2016-06-10 23:55:50 -0500 |
commit | 952660d2cf9b2e25b2014d117cce3bf4c93d6818 (patch) | |
tree | 96ac28191fd1a140b96ef48ebd7d74a1d8f533fd /app | |
parent | ff345f8ba11658c679b423e06bbc42b90af158eb (diff) | |
download | gitlab-ce-952660d2cf9b2e25b2014d117cce3bf4c93d6818.tar.gz |
Fixes a bug when assigning a label to multiple issuesfix-bulk-assign-labels
Fixes the case when we want to assign a label to multiple issues and one of the issues has already the label we want to apply.
Diffstat (limited to 'app')
-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 |