Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
5ddb32f3
Commit
5ddb32f3
authored
May 28, 2019
by
Liam McAndrew
Committed by
James Lopez
May 28, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix order dependency with user params during imports
parent
5fd44155
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
3 deletions
+17
-3
changelogs/unreleased/fix-import-param-ordering.yml
changelogs/unreleased/fix-import-param-ordering.yml
+5
-0
lib/gitlab/import_export/members_mapper.rb
lib/gitlab/import_export/members_mapper.rb
+1
-1
spec/lib/gitlab/import_export/members_mapper_spec.rb
spec/lib/gitlab/import_export/members_mapper_spec.rb
+11
-2
No files found.
changelogs/unreleased/fix-import-param-ordering.yml
0 → 100644
View file @
5ddb32f3
---
title
:
Fix order dependency with user params during imports
merge_request
:
28719
author
:
type
:
fixed
lib/gitlab/import_export/members_mapper.rb
View file @
5ddb32f3
...
...
@@ -63,7 +63,7 @@ module Gitlab
'source_id'
=>
@project
.
id
,
'importing'
=>
true
,
'access_level'
=>
[
member
[
'access_level'
],
ProjectMember
::
MAINTAINER
].
min
)
)
.
except
(
'user_id'
)
end
def
parsed_hash
(
member
)
...
...
spec/lib/gitlab/import_export/members_mapper_spec.rb
View file @
5ddb32f3
...
...
@@ -12,7 +12,6 @@ describe Gitlab::ImportExport::MembersMapper do
"access_level"
=>
40
,
"source_id"
=>
14
,
"source_type"
=>
"Project"
,
"user_id"
=>
19
,
"notification_level"
=>
3
,
"created_at"
=>
"2016-03-11T10:21:44.822Z"
,
"updated_at"
=>
"2016-03-11T10:21:44.822Z"
,
...
...
@@ -25,7 +24,8 @@ describe Gitlab::ImportExport::MembersMapper do
"id"
=>
exported_user_id
,
"email"
=>
user2
.
email
,
"username"
=>
'test'
}
},
"user_id"
=>
19
},
{
"id"
=>
3
,
...
...
@@ -80,6 +80,15 @@ describe Gitlab::ImportExport::MembersMapper do
expect
(
ProjectMember
.
find_by_user_id
(
user2
.
id
).
access_level
).
to
eq
(
ProjectMember
::
MAINTAINER
)
end
it
'removes old user_id from member_hash to avoid conflict with user key'
do
expect
(
ProjectMember
).
to
receive
(
:create
)
.
twice
.
with
(
hash_excluding
(
'user_id'
))
.
and_call_original
members_mapper
.
map
end
context
'user is not an admin'
do
let
(
:user
)
{
create
(
:user
)
}
...
...
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