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
ce38ae8c
Commit
ce38ae8c
authored
Oct 27, 2016
by
Ahmad Sherif
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix importing MR comments from GitHub
parent
4259334f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
6 deletions
+8
-6
CHANGELOG.md
CHANGELOG.md
+1
-0
lib/gitlab/github_import/importer.rb
lib/gitlab/github_import/importer.rb
+7
-6
No files found.
CHANGELOG.md
View file @
ce38ae8c
...
...
@@ -27,6 +27,7 @@ Please view this file on the master branch, on stable branches it's out of date.
-
Show full status link on MR & commit pipelines
-
Fix documents and comments on Build API
`scope`
-
Fix applying labels for GitHub-imported MRs
-
Fix importing MR comments from GitHub
-
Refactor email, use setter method instead AR callbacks for email attribute (Semyon Pupkov)
## 8.13.1 (2016-10-25)
...
...
lib/gitlab/github_import/importer.rb
View file @
ce38ae8c
...
...
@@ -150,21 +150,22 @@ module Gitlab
def
import_comments
client
.
issues_comments
(
repo
,
per_page:
100
)
do
|
comments
|
create_comments
(
comments
,
:issue
)
create_comments
(
comments
)
end
client
.
pull_requests_comments
(
repo
,
per_page:
100
)
do
|
comments
|
create_comments
(
comments
,
:pull_request
)
create_comments
(
comments
)
end
end
def
create_comments
(
comments
,
issuable_type
)
def
create_comments
(
comments
)
ActiveRecord
::
Base
.
no_touching
do
comments
.
each
do
|
raw
|
begin
comment
=
CommentFormatter
.
new
(
project
,
raw
)
issuable_class
=
issuable_type
==
:issue
?
Issue
:
MergeRequest
iid
=
raw
.
send
(
"
#{
issuable_type
}
_url"
).
split
(
'/'
).
last
# GH doesn't return parent ID directly
# GH does not return info about comment's parent, so we guess it by checking its URL!
*
_
,
parent
,
iid
=
URI
(
raw
.
html_url
).
path
.
split
(
'/'
)
issuable_class
=
parent
==
'issues'
?
Issue
:
MergeRequest
issuable
=
issuable_class
.
find_by_iid
(
iid
)
next
unless
issuable
...
...
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