diff options
author | Tiago Botelho <tiagonbotelho@hotmail.com> | 2018-03-14 14:17:35 +0000 |
---|---|---|
committer | Tiago Botelho <tiagonbotelho@hotmail.com> | 2018-03-16 13:56:11 +0000 |
commit | 5248e37f27fe7afaec40b61041e9fa9fe70b2952 (patch) | |
tree | fe0edd37357f2a110bac4bf0fd6adc2255cbb998 /lib/gitlab/import_export | |
parent | a63d74709be2af852e3c98505a18664e6bca9754 (diff) | |
download | gitlab-ce-5248e37f27fe7afaec40b61041e9fa9fe70b2952.tar.gz |
Adds the option to override project description on export via API
and fixes the project description not being imported
Diffstat (limited to 'lib/gitlab/import_export')
-rw-r--r-- | lib/gitlab/import_export/project_tree_restorer.rb | 10 | ||||
-rw-r--r-- | lib/gitlab/import_export/project_tree_saver.rb | 7 |
2 files changed, 14 insertions, 3 deletions
diff --git a/lib/gitlab/import_export/project_tree_restorer.rb b/lib/gitlab/import_export/project_tree_restorer.rb index 4b5f9f3a926..8f5bb8f9597 100644 --- a/lib/gitlab/import_export/project_tree_restorer.rb +++ b/lib/gitlab/import_export/project_tree_restorer.rb @@ -35,6 +35,8 @@ module Gitlab end def restored_project + return @project unless @tree_hash + @restored_project ||= restore_project end @@ -81,9 +83,13 @@ module Gitlab end def restore_project - return @project unless @tree_hash + params = project_params + + if params[:description].present? + params[:description_html] = nil + end - @project.update_columns(project_params) + @project.update_columns(params) @project end diff --git a/lib/gitlab/import_export/project_tree_saver.rb b/lib/gitlab/import_export/project_tree_saver.rb index 3473b466936..5510c0b8b2f 100644 --- a/lib/gitlab/import_export/project_tree_saver.rb +++ b/lib/gitlab/import_export/project_tree_saver.rb @@ -5,7 +5,8 @@ module Gitlab attr_reader :full_path - def initialize(project:, current_user:, shared:) + def initialize(project:, current_user:, shared:, params: {}) + @params = params @project = project @current_user = current_user @shared = shared @@ -25,6 +26,10 @@ module Gitlab private def project_json_tree + if @params[:description].present? + project_json['description'] = @params[:description] + end + project_json['project_members'] += group_members_json project_json.to_json |