Fix preselected namespace when creating a project
Merged
requested to merge davidpiegza/gitlab-ce:26879-fix-preselected-namespace-when-creating-project into master
Do not update/delete: Banner broadcast message test data
Do not update/delete: Notification broadcast message test data
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]
).
In order to fix fetching the namespace_id
from the params hash.
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.
Closes #26879 (closed)