Apply labels only if we picked a label from the dropdown
This commit is contained in:
parent
1e96e7f6d2
commit
618cf373ca
2 changed files with 26 additions and 4 deletions
|
@ -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()
|
||||
|
|
Loading…
Reference in a new issue