Commit ced56641 authored by James Lopez's avatar James Lopez
Browse files

refactored code based on feedback

parent a1a2a339724a
......@@ -406,8 +406,7 @@ def clear_import_data
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 @@ def import_url
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 @@ def full_url
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