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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
ed2f7f84
Commit
ed2f7f84
authored
Apr 07, 2020
by
George Koltsov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ensure members mapper always run on Project Import
parent
66a425e2
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
0 deletions
+41
-0
changelogs/unreleased/georgekoltsov-always-run-members-mapper.yml
...gs/unreleased/georgekoltsov-always-run-members-mapper.yml
+5
-0
lib/gitlab/import_export/project/tree_restorer.rb
lib/gitlab/import_export/project/tree_restorer.rb
+5
-0
spec/lib/gitlab/import_export/project/tree_restorer_spec.rb
spec/lib/gitlab/import_export/project/tree_restorer_spec.rb
+31
-0
No files found.
changelogs/unreleased/georgekoltsov-always-run-members-mapper.yml
0 → 100644
View file @
ed2f7f84
---
title
:
Ensure members are always added on Project Import when importing as admin
merge_request
:
29046
author
:
type
:
fixed
lib/gitlab/import_export/project/tree_restorer.rb
View file @
ed2f7f84
...
...
@@ -25,6 +25,11 @@ module Gitlab
@project_members
=
relation_reader
.
consume_relation
(
importable_path
,
'project_members'
)
.
map
(
&
:first
)
# ensure users are mapped before tree restoration
# so that even if there is no content to associate
# users with, they are still added to the project
members_mapper
.
map
if
relation_tree_restorer
.
restore
import_failure_service
.
with_retry
(
action:
'set_latest_merge_request_diff_ids!'
)
do
@project
.
merge_requests
.
set_latest_merge_request_diff_ids!
...
...
spec/lib/gitlab/import_export/project/tree_restorer_spec.rb
View file @
ed2f7f84
...
...
@@ -953,6 +953,37 @@ describe Gitlab::ImportExport::Project::TreeRestorer do
end
end
end
context
'with project members'
do
let
(
:user
)
{
create
(
:user
,
:admin
)
}
let
(
:user2
)
{
create
(
:user
)
}
let
(
:project_members
)
do
[
{
"id"
=>
2
,
"access_level"
=>
40
,
"source_type"
=>
"Project"
,
"notification_level"
=>
3
,
"user"
=>
{
"id"
=>
user2
.
id
,
"email"
=>
user2
.
email
,
"username"
=>
'test'
}
}
]
end
let
(
:tree_hash
)
{
{
'project_members'
=>
project_members
}
}
before
do
project
.
add_maintainer
(
user
)
end
it
'restores project members'
do
restorer
.
restore
expect
(
project
.
members
.
map
(
&
:user
)).
to
contain_exactly
(
user
,
user2
)
end
end
end
context
'JSON with invalid records'
do
...
...
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