Commit 659cceb0 authored by Rémy Coutable's avatar Rémy Coutable
Browse files

Merge branch 'fix/import-user-validation-error' into 'master'

Fix user validation error in Import/Export

Closes #23833

See merge request !8909
---
title: Remove old project members when retrying an export
merge_request:
author:
......@@ -41,6 +41,8 @@ def missing_keys_tracking_hash
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 @@
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
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment