Members with accepted invite show as Pending after Import
A member is considered pending for 2 reasons: if invite_token or requested_at is present https://gitlab.com/gitlab-org/gitlab/blob/master/app/models/member.rb#L306-306
When a user is invited to the group, exported and imported at a new destination, then these 2 fields are empty in the group export archive, but on Import:
-
invite_emailis not empty in the export - Because of that,
before_validationis ran https://gitlab.com/gitlab-org/gitlab/blob/master/app/models/member.rb#L93-93 to generate newinvite_token - Because of that,
pending?returns true and user is shown in the Pending list
This looks like a bug in the Member model, as when membership is accepted we do not reset invite_email to nil (although I am not sure if we should, that's just a guess). However we can also add a bit log logic to Members Mapper to remove invite_* fields if member hash has user associated with it.