BigW Consortium Gitlab

Commit ced56641 by James Lopez

refactored code based on feedback

parent 6dfb5d7c
......@@ -406,8 +406,7 @@ class Project < ActiveRecord::Base
def import_url=(value)
import_url = Gitlab::ImportUrl.new(value)
# deletes any existing import_data
create_import_data(credentials: import_url.credentials)
create_or_update_import_data(import_url.credentials)
super(import_url.sanitized_url)
end
......@@ -420,6 +419,13 @@ class Project < ActiveRecord::Base
end
end
def create_or_update_import_data(credentials)
project_import_data = import_data || ProjectImportData.new
project_import_data.credentials = credentials
project_import_data.project_id = id
project_import_data.save
end
def import?
external_import? || forked?
end
......
......@@ -20,10 +20,10 @@ module Gitlab
private
def generate_full_url
return @url unless @credentials
return @url unless credentials
@full_url = @url.dup
@full_url.user = @credentials[:user]
@full_url.password = @credentials[:password]
@full_url.user = credentials[:user]
@full_url.password = credentials[:password]
@full_url
end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment