Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWill Chandler <wchandler@gitlab.com>2019-09-06 11:33:18 +0300
committerThong Kuah <tkuah@gitlab.com>2019-09-06 11:33:18 +0300
commit525449d7ce79c8c538db17c48399e93ee874d289 (patch)
treed4565b62fe3b33054087dd4cf236615a172fb599 /lib/gitlab
parent6def5bd66b04f887dd0d24ae4030ec86195ff7cb (diff)
Stop empty external auth classification labels overriding default labels
Most of the project templates bundled with GitLab have an empty string set for `external_authorization_classification_label` in their `project.json`. When imported this overrides the default label set on the instance, causing the label to appear empty. This change sets empty labels to nil during import, allowing the default label to override it and be applied to the project.
Diffstat (limited to 'lib/gitlab')
-rw-r--r--lib/gitlab/import_export/project_tree_restorer.rb9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/gitlab/import_export/project_tree_restorer.rb b/lib/gitlab/import_export/project_tree_restorer.rb
index 91fe4e5d074..685cf53f27f 100644
--- a/lib/gitlab/import_export/project_tree_restorer.rb
+++ b/lib/gitlab/import_export/project_tree_restorer.rb
@@ -107,7 +107,7 @@ module Gitlab
def project_params
@project_params ||= begin
- attrs = json_params.merge(override_params).merge(visibility_level)
+ attrs = json_params.merge(override_params).merge(visibility_level, external_label)
# Cleaning all imported and overridden params
Gitlab::ImportExport::AttributeCleaner.clean(relation_hash: attrs,
@@ -135,6 +135,13 @@ module Gitlab
{ 'visibility_level' => level }
end
+ def external_label
+ label = override_params['external_authorization_classification_label'].presence ||
+ json_params['external_authorization_classification_label'].presence
+
+ { 'external_authorization_classification_label' => label }
+ end
+
# Given a relation hash containing one or more models and its relationships,
# loops through each model and each object from a model type and
# and assigns its correspondent attributes hash from +tree_hash+