Skip to content

Remove invalid check for trial creation method

What does this MR do and why?

📓 backstory:

  • checking if namespace was invalid @namespace.invalid? was originally added for the apply trial action in 64e457e8
  • it was added in that commit due to the fact that we gave an option to create a new namespace during trial selection
  • in https://gitlab.com/gitlab-org/gitlab/-/issues/339654 we added the ability for a trial to be automatically applied if there was only one possible namespace.
  • during that addition the @namespace.invalid? check was inadvertently added to the create_lead action when refactoring in !70196 (diffs) when code was DRYd up

Therefore, as we slowly refactor this controller via #393969 (closed) we can remove that check(only behavior change in this MR and no tests really covered it for create_lead)...

Further items done to fulfill the overall plan with the idea that refactoring items out of the action methods only makes that process harder as it reduced readability and could falsely indicate changes during other refactoring. We are making it look more messy in hopes to get to an overall clean controller layer and rely on the service layer and other concepts to reduced the trials controller to 2 total actions.

  • resolve rubocop items in the controller
  • expose the complexity directly in the create_lead/apply actions as this will aid us in the next step of our refactoring plan
  • moves group creation out of the before_action on apply as it wasn't obvious before.
  • add test coverage that was missing for the success redirection path in create_lead action
  • re-organize existing test for ease of refactor and clarity

note test coverage for all of these paths added in !115895 (merged)

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 #393969 (closed)

Edited by Doug Stull

Merge request reports

Loading