Merge branch 'fix/import-user-validation-error' into 'master'
Fix user validation error in Import/Export Closes #23833 See merge request !8909
This commit is contained in:
commit
659cceb0e8
3 changed files with 30 additions and 0 deletions
|
@ -0,0 +1,4 @@
|
|||
---
|
||||
title: Remove old project members when retrying an export
|
||||
merge_request:
|
||||
author:
|
|
@ -41,6 +41,8 @@ module Gitlab
|
|||
end
|
||||
|
||||
def ensure_default_member!
|
||||
@project.project_members.destroy_all
|
||||
|
||||
ProjectMember.create!(user: @user, access_level: ProjectMember::MASTER, source_id: @project.id, importing: true)
|
||||
end
|
||||
|
||||
|
|
|
@ -92,5 +92,29 @@ describe Gitlab::ImportExport::MembersMapper, services: true do
|
|||
expect(members_mapper.map[exported_user_id]).to eq(user2.id)
|
||||
end
|
||||
end
|
||||
|
||||
context 'importer same as group member' do
|
||||
let(:user2) { create(:admin, authorized_projects_populated: true) }
|
||||
let(:group) { create(:group) }
|
||||
let(:project) { create(:empty_project, :public, name: 'searchable_project', namespace: group) }
|
||||
let(:members_mapper) do
|
||||
described_class.new(
|
||||
exported_members: exported_members, user: user2, project: project)
|
||||
end
|
||||
|
||||
before do
|
||||
group.add_users([user, user2], GroupMember::DEVELOPER)
|
||||
end
|
||||
|
||||
it 'maps the project member' do
|
||||
expect(members_mapper.map[exported_user_id]).to eq(user2.id)
|
||||
end
|
||||
|
||||
it 'maps the project member if it already exists' do
|
||||
project.add_master(user2)
|
||||
|
||||
expect(members_mapper.map[exported_user_id]).to eq(user2.id)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue