diff options
author | Valery Sizov <valery@gitlab.com> | 2015-02-03 04:01:07 +0300 |
---|---|---|
committer | Valery Sizov <valery@gitlab.com> | 2015-02-05 23:50:34 +0300 |
commit | 33349dd54928a0b074b4ae3ebfabf214799fc085 (patch) | |
tree | 593a14d0f6df812410349f353e252e3a58d8cacd /lib/gitlab/github_import | |
parent | 713bc152bde5396bb95a1555907bcd9a2847839d (diff) |
GitLab.com integration: refactoring
Diffstat (limited to 'lib/gitlab/github_import')
-rw-r--r-- | lib/gitlab/github_import/client.rb | 2 | ||||
-rw-r--r-- | lib/gitlab/github_import/importer.rb | 9 |
2 files changed, 7 insertions, 4 deletions
diff --git a/lib/gitlab/github_import/client.rb b/lib/gitlab/github_import/client.rb index 2e454e7c10f..cf43d36c6c3 100644 --- a/lib/gitlab/github_import/client.rb +++ b/lib/gitlab/github_import/client.rb @@ -14,7 +14,7 @@ module Gitlab private def config - Gitlab.config.omniauth.providers.select{|provider| provider.name == "github"}.first + Gitlab.config.omniauth.providers.find{|provider| provider.name == "github"} end def github_options diff --git a/lib/gitlab/github_import/importer.rb b/lib/gitlab/github_import/importer.rb index 180ad6c3018..91a4595b9ea 100644 --- a/lib/gitlab/github_import/importer.rb +++ b/lib/gitlab/github_import/importer.rb @@ -5,6 +5,7 @@ module Gitlab def initialize(project) @project = project + @formatter = Gitlab::ImportFormatter.new end def execute @@ -13,12 +14,14 @@ module Gitlab #Issues && Comments client.list_issues(project.import_source, state: :all).each do |issue| if issue.pull_request.nil? - body = "*Created by: #{issue.user.login}*\n\n#{issue.body}" + + body = @formatter.author_line(issue.user.login, issue.body) if issue.comments > 0 - body += "\n\n\n**Imported comments:**\n" + body += @formatter.comments_header + client.issue_comments(project.import_source, issue.number).each do |c| - body += "\n\n*By #{c.user.login} on #{c.created_at}*\n\n#{c.body}" + body += @formatter.comment_to_md(c.user.login, c.created_at, c.body) end end |