diff options
author | Douwe Maan <douwe@gitlab.com> | 2018-04-05 18:18:49 +0300 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2018-04-05 18:18:49 +0300 |
commit | 082bf1c6ee97aefc9c53e7462cf870ce8ce0ad2b (patch) | |
tree | 68f6bbf147404ee8c273170c41e89882299969ea /app | |
parent | b2a7faa5a9223811884676bb1004f97fb8a18a54 (diff) | |
parent | 902cec12b5b531434ccf7ecf6df22ddb4249c253 (diff) |
Merge branch 'bvl-override-import-params' into 'master'
Allow passing params to import API to override project attributes
Closes gitlab-ee#4788
See merge request gitlab-org/gitlab-ce!18086
Diffstat (limited to 'app')
-rw-r--r-- | app/models/project.rb | 3 | ||||
-rw-r--r-- | app/services/projects/gitlab_projects_import_service.rb | 5 |
2 files changed, 5 insertions, 3 deletions
diff --git a/app/models/project.rb b/app/models/project.rb index ea9df9b10ef..1b29cbf28d2 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -637,7 +637,7 @@ class Project < ActiveRecord::Base end def create_or_update_import_data(data: nil, credentials: nil) - return unless import_url.present? && valid_import_url? + return if data.nil? && credentials.nil? project_import_data = import_data || build_import_data if data @@ -1487,6 +1487,7 @@ class Project < ActiveRecord::Base remove_import_jid update_project_counter_caches after_create_default_branch + refresh_markdown_cache! end def update_project_counter_caches diff --git a/app/services/projects/gitlab_projects_import_service.rb b/app/services/projects/gitlab_projects_import_service.rb index a68ecb4abe1..fb4afb85588 100644 --- a/app/services/projects/gitlab_projects_import_service.rb +++ b/app/services/projects/gitlab_projects_import_service.rb @@ -5,8 +5,8 @@ module Projects class GitlabProjectsImportService attr_reader :current_user, :params - def initialize(user, params) - @current_user, @params = user, params.dup + def initialize(user, import_params, override_params = nil) + @current_user, @params, @override_params = user, import_params.dup, override_params end def execute @@ -17,6 +17,7 @@ module Projects params[:import_type] = 'gitlab_project' params[:import_source] = import_upload_path + params[:import_data] = { data: { override_params: @override_params } } if @override_params ::Projects::CreateService.new(current_user, params).execute end |