• Stan Hu's avatar
    Gracefully handle orphaned member invites · f37742ff
    Stan Hu authored
    For some reason, member invite tokens can be cleared without saving an
    associated user. These entries cause 500 errors to show up in the member
    view, and they can't be fixed easily without manually deleting entries
    in the database.
    
    This commit does two things:
    
    1. Remove these orphaned entries from the database.
    
    2. Gracefully handle them in the code: log an exception with details and
       provide a message in the remove button that allows project/group admins
       to delete these entries.
    
    On GitLab.com, the migration removes 19 rows with the latest orphaned
    entry created on 2020-04-16. That suggests the underlying bug is still
    there but does not happen very often.
    
    Closes https://gitlab.com/gitlab-org/gitlab/-/issues/23198
    f37742ff
remove_orphaned_invited_members_spec.rb 2.2 KB