User::DestroyService should cleanup projects where user is mirror_user
From @DouweM comment in https://gitlab.com/gitlab-com/infrastructure/issues/3118#note_45260621:
81 have validation error
["Mirror user can't be blank"]
and import errorThe mirror user is not allowed to push code to all branches on this project.
All 81 have a mirror user that no longer exists
These should have their mirror_user
unset, and we should investigate how projects can get in this state.
From @DouweM comment in https://gitlab.com/gitlab-com/infrastructure/issues/3118#note_45346274:
What do we actually want to do with a mirror project when its
mirror_user
gets deleted? Right now we're tripping over this validation, which we'd also get if we were to nullifymirror_user_id
usingdependent: :nullify
or something. Maybe we should nullify it and setmirror
tofalse
? From theUsers::DestroyService
, that could beProject.where(mirror_user: user).update_all(mirror: false, mirror_user_id: nil)
. If possible, we should also set an import error to tell them why the mirror feature got disabled.