Skip to content

Fix update reviewers request when none is assigned

Tan Le requested to merge 385012-fix-suggeted-reviewers-update-sidebar into master

What does this MR do and why?

This MR fixes an issue where reviewers update requests with empty reviewers_ids params causing HTTP 500.

Screenshots or screen recordings

Please see the screen recording to demonstrate the error in the related issue.

How to set up and validate locally

  1. Ensure a SaaS (Gitlab.com) environment
    1. One way of doing this is to add a env.runit file to the root GDK folder with the following snippet
      export GITLAB_SIMULATE_SAAS=1
  2. Set ultimate license on a group http://gdk.test:3000/admin/groups
  3. Create a project in the ultimate group or use an existing one, e.g. http://gdk.test:3000/gitlab-org/gitlab-test
  4. Set the feature flag on rails console bundle exec rails c
    project = Project.find(2)
    Feature.enable(:suggested_reviewers_control, project)
  5. Enable suggested_reviewers_enabled project settings
    project.project_setting.update!(suggested_reviewers_enabled: true)
  6. Create a merge request on the project
  7. Use some existing project members
    suggested_reviewers = ["lea_mclaughlin", "ken"=]
  8. Add some suggestions to an existing open MR
    mr = MergeRequest.find(7)
    mr.build_predictions
    mr.predictions.update!(suggested_reviewers: { reviewers: suggested_reviewers })
  9. Navigate to the MR view page and click on the reviewers dropdown
  10. Click on tooltip (?) icon next to the Suggestions headert but do not assign any reviewers
  11. Click outside of the dropdown
  12. Confirm that there is no error shown on the flash message

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #385012 (closed)

Edited by Tan Le

Merge request reports

Loading