Skip to content

Draft: Make the personal namespace optional

Alex Pooley requested to merge 427730-poc-optional-personal-namespace-2 into master

What does this MR do and why?

image

Make user personal namespace optional. Primary plan is to disconnect the personal namespace creation via the User model callbacks.

  1. Don't build on user create
  2. Auto build user personal namespace in FactoryBot so specs pass for now
  3. Build in Users::CreateService
~/code/gdk/gitlab > ag -lw 'user\.namespace' app ee/app
app/models/namespace.rb
app/serializers/merge_request_current_user_entity.rb
app/serializers/admin/abuse_report_details_entity.rb
app/views/admin/users/show.html.haml
app/services/users/migrate_records_to_ghost_user_service.rb
ee/app/controllers/ee/admin/users_controller.rb
ee/app/controllers/ee/profiles/preferences_controller.rb
ee/app/views/profiles/preferences/_code_suggestions_settings.html.haml

Second stage will be to remove the before create user factory callback that creates the user's personal namespace. Then we can amend failing specs to use the uses with_namespace trait.

Possible roadmap:

  1. User still requires namespace. Move namespace creation from inside User model to outside the model and into services and elsewhere.
  2. Make user-namespace associational optional.

Note to self: need to revisit:

  • app/services/projects/fork_service.rb

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 #427730

Edited by Alex Pooley

Merge request reports