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-01-31 21:10:00 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-01-31 21:10:00 +0300
commit22dde36e800253350e5fa1d902f191a7f64bc6e9 (patch)
tree3b53aee41daed5efa0674f9ee2da83e17ef4e676 /app/models/namespace_setting.rb
parent6f18a8d0b00eae84d262dff137fddd9639f3c52a (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/namespace_setting.rb')
-rw-r--r--app/models/namespace_setting.rb13
1 files changed, 2 insertions, 11 deletions
diff --git a/app/models/namespace_setting.rb b/app/models/namespace_setting.rb
index 7f65fb3a378..aeb4d7a5694 100644
--- a/app/models/namespace_setting.rb
+++ b/app/models/namespace_setting.rb
@@ -14,10 +14,11 @@ class NamespaceSetting < ApplicationRecord
validates :enabled_git_access_protocol, inclusion: { in: enabled_git_access_protocols.keys }
- validate :default_branch_name_content
validate :allow_mfa_for_group
validate :allow_resource_access_token_creation_for_group
+ sanitizes! :default_branch_name
+
before_validation :normalize_default_branch_name
chronic_duration_attr :runner_token_expiration_interval_human_readable, :runner_token_expiration_interval
@@ -45,8 +46,6 @@ class NamespaceSetting < ApplicationRecord
NAMESPACE_SETTINGS_PARAMS
end
- sanitizes! :default_branch_name
-
def prevent_sharing_groups_outside_hierarchy
return super if namespace.root?
@@ -85,14 +84,6 @@ class NamespaceSetting < ApplicationRecord
self.default_branch_name = default_branch_name.presence
end
- def default_branch_name_content
- return if default_branch_name.nil?
-
- if default_branch_name.blank?
- errors.add(:default_branch_name, "can not be an empty string")
- end
- end
-
def allow_mfa_for_group
if namespace&.subgroup? && allow_mfa_for_subgroups == false
errors.add(:allow_mfa_for_subgroups, _('is not allowed since the group is not top-level group.'))