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 error The 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 nullify mirror_user_id using dependent: :nullify or something. Maybe we should nullify it and set mirror to false? From the Users::DestroyService, that could be Project.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.

Edited Jan 16, 2018 by Douwe Maan
Assignee Loading
Time tracking Loading