BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
1b53ed13
Commit
1b53ed13
authored
Jan 31, 2017
by
Rémy Coutable
Committed by
James Lopez
Feb 02, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Merge branch 'fix/import-user-validation-error' into 'master'
Fix user validation error in Import/Export Closes #23833 See merge request !8909
parent
e3be216a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
0 deletions
+30
-0
fix-import-user-validation-error.yml
changelogs/unreleased/fix-import-user-validation-error.yml
+4
-0
members_mapper.rb
lib/gitlab/import_export/members_mapper.rb
+2
-0
members_mapper_spec.rb
spec/lib/gitlab/import_export/members_mapper_spec.rb
+24
-0
No files found.
changelogs/unreleased/fix-import-user-validation-error.yml
0 → 100644
View file @
1b53ed13
---
title
:
Remove old project members when retrying an export
merge_request
:
author
:
lib/gitlab/import_export/members_mapper.rb
View file @
1b53ed13
...
...
@@ -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
...
...
spec/lib/gitlab/import_export/members_mapper_spec.rb
View file @
1b53ed13
...
...
@@ -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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment