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
Jérome Perrin
gitlab-ce
Commits
db322009
Commit
db322009
authored
Apr 13, 2017
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Import issues comments
parent
c2607666
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
0 deletions
+34
-0
lib/github/import.rb
lib/github/import.rb
+30
-0
lib/github/representation/issue.rb
lib/github/representation/issue.rb
+4
-0
No files found.
lib/github/import.rb
View file @
db322009
...
...
@@ -224,6 +224,36 @@ module Github
issue
.
created_at
=
representation
.
created_at
issue
.
updated_at
=
representation
.
updated_at
issue
.
save
(
validate:
false
)
if
issue
.
has_comments?
# Fetch comments
comments_url
=
"/repos/
#{
owner
}
/
#{
repo
}
/issues/
#{
issue
.
iid
}
/comments"
loop
do
comments
=
Github
::
Client
.
new
.
get
(
comments_url
)
ActiveRecord
::
Base
.
no_touching
do
comments
.
body
.
each
do
|
raw
|
begin
comment
=
Github
::
Representation
::
Comment
.
new
(
raw
)
note
=
Note
.
new
note
.
project_id
=
project
.
id
note
.
noteable
=
issue
note
.
note
=
comment
.
note
note
.
author_id
=
user_id
(
comment
.
author
,
project
.
creator_id
)
note
.
created_at
=
comment
.
created_at
note
.
updated_at
=
comment
.
updated_at
note
.
save!
(
validate:
false
)
rescue
=>
e
error
(
:comment
,
comment
.
url
,
e
.
message
)
end
end
end
break
unless
comments_url
=
comments
.
rels
[
:next
]
end
end
rescue
=>
e
error
(
:issue
,
representation
.
url
,
e
.
message
)
end
...
...
lib/github/representation/issue.rb
View file @
db322009
...
...
@@ -49,6 +49,10 @@ module Github
raw
[
'assignee'
].
present?
end
def
has_comments?
raw
[
'comments'
]
>
0
end
def
pull_request?
raw
[
'pull_request'
].
present?
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