"Delete source branch" is not updated when "Merge when pipeline succeeds" / "Set to Auto-Merge"

Summary

  • In merge request: When "Delete source branch" checkbox gets deactivated and pressing "Merge when pipeline succeeds", the information shown is still "Source branch will be deleted".
  • Only a visual bug (source branch will not be deleted)
  • Refreshing the page does not fix the problem either (see gif)

Steps to reproduce

04-01-2023_10-43-09

Example Project

What is the current bug behavior?

Message says "Source branch will be deleted"

What is the expected correct behavior?

Message says "Source branch will not be deleted"

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)

Implementation Guide

  1. Add a setRemoveSourceBranch function in https://gitlab.com/gitlab-org/gitlab/-/blob/master/app/assets/javascripts/vue_merge_request_widget/stores/mr_widget_store.js#L382 after the setApprovals function
  2. Create specs for the above in
  3. Change the checkbox component behavior from v-model to use the @change event instead https://gitlab.com/gitlab-org/gitlab/-/blob/master/app/assets/javascripts/vue_merge_request_widget/components/states/ready_to_merge.vue#L585
  4. When the event mentioned above is emitted, the removeSourceBranch must be updated and the setRemoveSourceBranch must be called to update the store
  5. Update any failing RSpec tests
Edited by Caroline Simpson