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
b3bb8dc4
Commit
b3bb8dc4
authored
Jan 18, 2017
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added spec replicating the problem
parent
35442766
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
60 additions
and
3 deletions
+60
-3
lib/gitlab/import_export/relation_factory.rb
lib/gitlab/import_export/relation_factory.rb
+1
-1
spec/lib/gitlab/import_export/members_mapper_spec.rb
spec/lib/gitlab/import_export/members_mapper_spec.rb
+2
-1
spec/lib/gitlab/import_export/relation_factory_spec.rb
spec/lib/gitlab/import_export/relation_factory_spec.rb
+57
-1
No files found.
lib/gitlab/import_export/relation_factory.rb
View file @
b3bb8dc4
...
...
@@ -14,7 +14,7 @@ module Gitlab
priorities: :label_priorities
,
label: :project_label
}.
freeze
USER_REFERENCES
=
%w[author_id assignee_id updated_by_id user_id created_by_id merge_user_id]
.
freeze
USER_REFERENCES
=
%w[author_id assignee_id updated_by_id user_id created_by_id merge_user_id
resolved_by_id
]
.
freeze
PROJECT_REFERENCES
=
%w[project_id source_project_id gl_project_id target_project_id]
.
freeze
...
...
spec/lib/gitlab/import_export/members_mapper_spec.rb
View file @
b3bb8dc4
...
...
@@ -75,8 +75,9 @@ describe Gitlab::ImportExport::MembersMapper, services: true do
expect
(
user2
.
authorized_project?
(
project
)).
to
be
true
end
context
'user is not admin'
do
context
'user is not a
n a
dmin'
do
let
(
:user
)
{
create
(
:user
,
authorized_projects_populated:
true
)
}
it
'does not map a project member'
do
expect
(
members_mapper
.
map
[
exported_user_id
]).
to
eq
(
user
.
id
)
end
...
...
spec/lib/gitlab/import_export/relation_factory_spec.rb
View file @
b3bb8dc4
...
...
@@ -3,7 +3,7 @@ require 'spec_helper'
describe
Gitlab
::
ImportExport
::
RelationFactory
,
lib:
true
do
let
(
:project
)
{
create
(
:empty_project
)
}
let
(
:members_mapper
)
{
double
(
'members_mapper'
).
as_null_object
}
let
(
:user
)
{
create
(
:
user
)
}
let
(
:user
)
{
create
(
:
admin
)
}
let
(
:created_object
)
do
described_class
.
create
(
relation_sym:
relation_sym
,
relation_hash:
relation_hash
,
...
...
@@ -122,4 +122,60 @@ describe Gitlab::ImportExport::RelationFactory, lib: true do
expect
(
created_object
.
values
).
not_to
include
(
99
)
end
end
context
'Notes user references'
do
let
(
:relation_sym
)
{
:notes
}
let
(
:new_user
)
{
create
(
:user
)
}
let
(
:exported_member
)
do
{
"id"
=>
999
,
"access_level"
=>
30
,
"source_id"
=>
1
,
"source_type"
=>
"Project"
,
"user_id"
=>
3
,
"notification_level"
=>
3
,
"created_at"
=>
"2016-11-18T09:29:42.634Z"
,
"updated_at"
=>
"2016-11-18T09:29:42.634Z"
,
"user"
=>
{
"id"
=>
new_user
.
id
,
"email"
=>
new_user
.
email
,
"username"
=>
new_user
.
username
}
}
end
let
(
:relation_hash
)
do
{
"id"
=>
4947
,
"note"
=>
"merged"
,
"noteable_type"
=>
"MergeRequest"
,
"author_id"
=>
999
,
"created_at"
=>
"2016-11-18T09:29:42.634Z"
,
"updated_at"
=>
"2016-11-18T09:29:42.634Z"
,
"project_id"
=>
1
,
"attachment"
=>
{
"url"
=>
nil
},
"noteable_id"
=>
377
,
"system"
=>
true
,
"author"
=>
{
"name"
=>
"Administrator"
},
"events"
=>
[
]
}
end
let
(
:members_mapper
)
do
Gitlab
::
ImportExport
::
MembersMapper
.
new
(
exported_members:
[
exported_member
],
user:
user
,
project:
project
)
end
it
'maps the right author to the imported note'
do
expect
(
created_object
.
author
).
to
eq
(
new_user
)
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