Epic bulk update copies and deletes labels unexpectedly

Summary

Bulk updating labels on epics behaves unexpectedly. When attempting to add a label to multiple epics, it will union the labels present and copy to all epics.

This is displayed in the dropdown. When selecting epics the dropdown continually populates with 'ticked' labels:

image

However, it contrasts with how issue bulk_update works, where only the intended actions are taken and existing labels are left as-is:

image

Steps to reproduce

  1. Create two epics; epic1 and epic2
  2. Add labels to epic1
  3. Go to the epic list
  4. Click 'Edit Epics'
  5. Select both epics
  6. Open the label dropdown and add a label new to both
  7. Click 'Update all'

Observe that the labels from epic1 are copied to epic2.

Example Project

What is the current bug behavior?

Labels are unexpectedly copied between epics.

What is the expected correct behavior?

Only the desired actions are taken (label(s) added, label(s) removed).

Relevant logs and/or screenshots

Output of checks

Results of GitLab environment info

Expand for output related to GitLab environment info

(For installations with omnibus-gitlab package run and paste the output of:
`sudo gitlab-rake gitlab:env:info`)

(For installations from source run and paste the output of:
`sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production`)

Results of GitLab application Check

Expand for output related to the GitLab application check

(For installations with omnibus-gitlab package run and paste the output of: sudo gitlab-rake gitlab:check SANITIZE=true)

(For installations from source run and paste the output of: sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true)

(we will only investigate if the tests are passing)

Possible fixes

Edited by John Hope