summaryrefslogtreecommitdiff
path: root/app/models/project.rb
diff options
context:
space:
mode:
authorJames Lopez <james@jameslopez.es>2016-03-21 13:15:51 +0100
committerJames Lopez <james@jameslopez.es>2016-03-21 13:15:51 +0100
commit383cc8404741f65bd52fbe80eec6c2dae2578fce (patch)
tree72cc6c535be43faa333867993cae2f3c85157a6d /app/models/project.rb
parent5f86912ef032845ef2a08acf70b434c0e4d58631 (diff)
downloadgitlab-ce-383cc8404741f65bd52fbe80eec6c2dae2578fce.tar.gz
some refactoring based on feedback
Diffstat (limited to 'app/models/project.rb')
-rw-r--r--app/models/project.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/app/models/project.rb b/app/models/project.rb
index 412c6c6732d..ab4afd4159e 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -404,6 +404,18 @@ class Project < ActiveRecord::Base
self.import_data.destroy if self.import_data
end
+ def import_url=(value)
+ sanitizer = Gitlab::ImportUrlSanitizer.new(value)
+ self[:import_url] = sanitizer.sanitized_url
+ create_import_data(credentials: sanitizer.credentials)
+ end
+
+ def import_url
+ if import_data
+ Gitlab::ImportUrlExposer.expose(import_url: self[:import_url], credentials: import_data.credentials)
+ end
+ end
+
def import?
external_import? || forked?
end