gitlab-org--gitlab-foss/spec/services/users
Timothy Andrew 133f00bedd Move records to the ghost user in a transaction.
- While deleting a user, some of the user's associated records are moved to the
  ghost user so they aren't deleted. The user is blocked before these records
  are moved, to prevent the user from creating new records while the migration
  is happening, and so preventing a data race.

- Previously, if the migration failed, the user would _remain_ blocked, which is
  not the expected behavior. On the other hand, we can't just stick the block +
  migration into a transaction, because we want the block to be committed before
  the migration starts (for the data race reason mentioned above).

- One solution (implemented in this commit) is to block the user in a parent
  transaction, migrate the associated records in a nested sub-transaction, and
  then unblock the user in the parent transaction if the sub-transaction fails.
2017-04-24 06:46:10 +00:00
..
activity_service_spec.rb Add a new Gitlab::UserActivities class to track user activities 2017-04-14 15:20:55 +02:00
build_service_spec.rb Refactor build_service_spec 2017-04-13 22:24:44 +03:00
create_service_spec.rb Implement Users::BuildService 2017-04-13 13:02:59 +03:00
destroy_service_spec.rb Hard delete users' associated records deleted from AbuseReports 2017-04-16 08:36:33 -07:00
migrate_to_ghost_user_service_spec.rb Move records to the ghost user in a transaction. 2017-04-24 06:46:10 +00:00
refresh_authorized_projects_service_spec.rb Use :empty_project where possible in service specs 2017-03-27 20:44:09 -04:00