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:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-09-20 06:12:09 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-09-20 06:12:09 +0300
commit9a61b4604efea1c8e57f4c90addbc94ecbe874de (patch)
treec599b6dfb03bd97150add252f228775bb212a0e1 /app/models/concerns
parent05e8f05317356d094906344c27b2abc25aadd4eb (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/concerns')
-rw-r--r--app/models/concerns/protected_ref.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/app/models/concerns/protected_ref.rb b/app/models/concerns/protected_ref.rb
index a87eadb9332..ea8a1640bea 100644
--- a/app/models/concerns/protected_ref.rb
+++ b/app/models/concerns/protected_ref.rb
@@ -3,6 +3,8 @@
module ProtectedRef
extend ActiveSupport::Concern
+ include Importable
+
included do
belongs_to :project, touch: true
@@ -32,12 +34,13 @@ module ProtectedRef
# to fail.
has_many :"#{type}_access_levels", inverse_of: self.model_name.singular
+ # Overridden in EE with `if: -> { false }` so this validation does not apply on an EE instance.
validates :"#{type}_access_levels",
length: {
is: 1,
message: "are restricted to a single instance per #{self.model_name.human}."
},
- unless: -> { allow_multiple?(type) }
+ unless: -> { allow_multiple?(type) || importing? }
accepts_nested_attributes_for :"#{type}_access_levels", allow_destroy: true
end