summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Lopez <james@jameslopez.es>2016-04-06 10:36:30 +0200
committerJames Lopez <james@jameslopez.es>2016-04-06 10:36:30 +0200
commitb97654393e326095c7d95ccc1eb9f583a3b23da9 (patch)
tree0e16ecfa3baaafc65593921fdbe09b8a96f940c3
parent5e51fce4dcd62997f372aed44badc844f98851e9 (diff)
downloadgitlab-ce-b97654393e326095c7d95ccc1eb9f583a3b23da9.tar.gz
fix some issues with credentials
-rw-r--r--app/models/project_import_data.rb4
-rw-r--r--lib/gitlab/bitbucket_import/client.rb12
-rw-r--r--lib/gitlab/fogbugz_import/importer.rb2
3 files changed, 9 insertions, 9 deletions
diff --git a/app/models/project_import_data.rb b/app/models/project_import_data.rb
index 225cbda15b1..e984832685b 100644
--- a/app/models/project_import_data.rb
+++ b/app/models/project_import_data.rb
@@ -22,7 +22,7 @@ class ProjectImportData < ActiveRecord::Base
before_validation :symbolize_credentials
def symbolize_credentials
- return if credentials.blank?
- credentials.deep_symbolize_keys!
+ # bang doesn't work here
+ self.credentials = self.credentials.deep_symbolize_keys unless self.credentials.blank?
end
end
diff --git a/lib/gitlab/bitbucket_import/client.rb b/lib/gitlab/bitbucket_import/client.rb
index 49f86ab5edf..9bb507b5edd 100644
--- a/lib/gitlab/bitbucket_import/client.rb
+++ b/lib/gitlab/bitbucket_import/client.rb
@@ -6,10 +6,10 @@ module Gitlab
attr_reader :consumer, :api
def self.from_project(project)
- credentials = project.import_data if project.import_data
- if credentials && credentials[:bb_session]
- token = credentials[:bb_session][:bitbucket_access_token]
- token_secret = credentials[:bb_session][:bitbucket_access_token_secret]
+ import_data_credentials = project.import_data.credentials if project.import_data
+ if import_data_credentials && import_data_credentials[:bb_session]
+ token = import_data_credentials[:bb_session][:bitbucket_access_token]
+ token_secret = import_data_credentials[:bb_session][:bitbucket_access_token_secret]
new(token, token_secret)
else
raise Projects::ImportService::Error, "Unable to find project import data credentials for project ID: #{@project.id}"
@@ -65,7 +65,7 @@ module Gitlab
def issues(project_identifier)
all_issues = []
offset = 0
- per_page = 50 # Maximum number allowed by Bitbucket
+ per_page = 50 # Maximum number allowed by Bitbucket
index = 0
begin
@@ -131,7 +131,7 @@ module Gitlab
end
def config
- Gitlab.config.omniauth.providers.find { |provider| provider.name == "bitbucket"}
+ Gitlab.config.omniauth.providers.find { |provider| provider.name == "bitbucket" }
end
def bitbucket_options
diff --git a/lib/gitlab/fogbugz_import/importer.rb b/lib/gitlab/fogbugz_import/importer.rb
index 249c5b48b1c..42f9b6eab84 100644
--- a/lib/gitlab/fogbugz_import/importer.rb
+++ b/lib/gitlab/fogbugz_import/importer.rb
@@ -31,7 +31,7 @@ module Gitlab
private
def import_data_credentials
- @import_data_credentials ||= project.import_data if project.import_data
+ @import_data_credentials ||= project.import_data.credentials if project.import_data
end
def user_map