summaryrefslogtreecommitdiff
path: root/lib/gitlab/gitlab_import/importer.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gitlab/gitlab_import/importer.rb')
-rw-r--r--lib/gitlab/gitlab_import/importer.rb10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/gitlab/gitlab_import/importer.rb b/lib/gitlab/gitlab_import/importer.rb
index 3e9087a556c..a529483c1e2 100644
--- a/lib/gitlab/gitlab_import/importer.rb
+++ b/lib/gitlab/gitlab_import/importer.rb
@@ -6,6 +6,7 @@ module Gitlab
def initialize(project)
@project = project
@client = Client.new(project.creator.gitlab_access_token)
+ @formatter = Gitlab::ImportFormatter.new
end
def execute
@@ -15,15 +16,16 @@ module Gitlab
issues = client.issues(project_identifier)
issues.each do |issue|
- body = "*Created by: #{issue["author"]["name"]}*\n\n#{issue["description"]}"
-
+ body = @formatter.author_line(issue["author"]["name"], issue["description"])
comments = client.issue_comments(project_identifier, issue["id"])
+
if comments.any?
- body += "\n\n\n**Imported comments:**\n"
+ body += @formatter.comments_header
end
+
comments.each do |comment|
- body += "\n\n*By #{comment["author"]["name"]} on #{comment["created_at"]}*\n\n#{comment["body"]}"
+ body += @formatter.comment_to_md(comment["author"]["name"], comment["created_at"], comment["body"])
end
project.issues.create!(