Fix preselected namespace when creating a project
What does this MR do?
It fixes the preselected namespace on the projects/new
page with a given namespace_id
in params.
Currently, the wrong namespace gets selected when the user tries to create a project and gets a validation error. In this case the namespace of the current user gets selected (see Issue #26879 (closed)).
This is because the params
hash in the controller changes and the provided namespace_id
is then in a project
subhash (e.g. params[:project][:namespace_id]
instead of params[:namespace_id]
).
Why was this MR needed?
In order to fix fetching the namespace_id
from the params hash.
Open questions
The current solution will look up the namespace_id
in the project subhash first and then in params. If it's present in both the project subhash has priority. But I think this shouldn't be a problem.
I'm not sure if I can already use the Hash#dig
method here.
What are the relevant issue numbers?
Closes #26879 (closed)