Commit 618cf373 authored by Alfredo Sumaran's avatar Alfredo Sumaran

Apply labels only if we picked a label from the dropdown

parent 1e96e7f6
......@@ -7,11 +7,25 @@ class @IssuableBulkActions
@issues = @getElement('.issues-list .issue')
} = opts
# Save instance
@form.data 'bulkActions', @
@disableWillUpdate()
@bindEvents()
# Fixes bulk-assign not working when navigating through pages
Issuable.initChecks();
enableWillUpdate: ->
@toggleWillUpdate(true)
disableWillUpdate: ->
@toggleWillUpdate(false)
toggleWillUpdate: (enable)->
@willUpdateLabels = if enable? then enable else not @willUpdateLabels
getElement: (selector) ->
@container.find selector
......@@ -87,11 +101,12 @@ class @IssuableBulkActions
add_label_ids : []
remove_label_ids : []
@getLabelsToApply().map (id) ->
formData.update.add_label_ids.push id
if @willUpdateLabels
@getLabelsToApply().map (id) ->
formData.update.add_label_ids.push id
@getLabelsToRemove().map (id) ->
formData.update.remove_label_ids.push id
@getLabelsToRemove().map (id) ->
formData.update.remove_label_ids.push id
formData
......
......@@ -319,6 +319,8 @@ class @LabelsSelect
multiSelect: $dropdown.hasClass 'js-multiselect'
clicked: (label) ->
_this.enableBulkLabelDropdown()
if $dropdown.hasClass('js-filter-bulk-update')
return
......@@ -377,3 +379,8 @@ class @LabelsSelect
label_ids.push $("#issue_#{issue_id}").data('labels')
_.intersection.apply _, label_ids
enableBulkLabelDropdown: ->
if $('.selected_issue:checked').length
issuableBulkActions = $('.bulk-update').data('bulkActions')
issuableBulkActions.enableWillUpdate()
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