diff options
author | James Lopez <james@jameslopez.es> | 2016-04-01 12:04:41 +0200 |
---|---|---|
committer | James Lopez <james@jameslopez.es> | 2016-04-01 12:04:41 +0200 |
commit | 6d12d79d29e035c7238aa7112db1429711e61a65 (patch) | |
tree | 0779aa769d808b5f21817f72e3070687d737ec3d /lib/gitlab | |
parent | 075b56aae2e045e930580985234276edb353747f (diff) | |
download | gitlab-ce-6d12d79d29e035c7238aa7112db1429711e61a65.tar.gz |
fix fogbugz import
Diffstat (limited to 'lib/gitlab')
-rw-r--r-- | lib/gitlab/fogbugz_import/importer.rb | 14 | ||||
-rw-r--r-- | lib/gitlab/fogbugz_import/project_creator.rb | 3 |
2 files changed, 8 insertions, 9 deletions
diff --git a/lib/gitlab/fogbugz_import/importer.rb b/lib/gitlab/fogbugz_import/importer.rb index c33b3541dd8..c88a44573a7 100644 --- a/lib/gitlab/fogbugz_import/importer.rb +++ b/lib/gitlab/fogbugz_import/importer.rb @@ -8,7 +8,7 @@ module Gitlab import_data = project.import_data.try(:data) repo_data = import_data['repo'] if import_data - if import_data_credentials && import_data_credentials['repo'] + if defined?(repo_data) @repo = FogbugzImport::Repository.new(repo_data) @known_labels = Set.new else @@ -18,10 +18,8 @@ module Gitlab def execute return true unless repo.valid? - - data = project.import_data.try(:data) - - client = Gitlab::FogbugzImport::Client.new(token: data['fb_session']['token'], uri: data['fb_session']['uri']) + Rails.logger.error import_data_credentials.inspect + client = Gitlab::FogbugzImport::Client.new(token: import_data_credentials['fb_session']['token'], uri: import_data_credentials['fb_session']['uri']) @cases = client.cases(@repo.id.to_i) @categories = client.categories @@ -34,7 +32,7 @@ module Gitlab private def import_data_credentials - @import_data_credentials ||= project.import_data.credentials if project.import_data + @import_data_credentials ||= project.import_data.stringified_credentials if project.import_data end def user_map @@ -244,8 +242,8 @@ module Gitlab def build_attachment_url(rel_url) data = project.import_data.try(:data) - uri = data['fb_session']['uri'] - token = data['fb_session']['token'] + uri = import_data_credentials['fb_session']['uri'] + token = import_data_credentials['fb_session']['token'] "#{uri}/#{rel_url}&token=#{token}" end diff --git a/lib/gitlab/fogbugz_import/project_creator.rb b/lib/gitlab/fogbugz_import/project_creator.rb index 939cb96c101..0a87b406c56 100644 --- a/lib/gitlab/fogbugz_import/project_creator.rb +++ b/lib/gitlab/fogbugz_import/project_creator.rb @@ -25,9 +25,10 @@ module Gitlab ).execute import_data = project.import_data + import_data.data = { 'repo' => repo.raw_data, 'user_map' => user_map } + # merge! with a bang doesn't work here import_data.credentials = import_data.credentials.merge('fb_session' => fb_session) - import_data.data = { 'repo' => repo.raw_data, 'user_map' => user_map } import_data.save project |