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-02-07 15:10:09 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-02-07 15:10:09 +0300
commit75f809a2ff829574ab91628407993187d55e14a4 (patch)
treee781d4cdc7bc7785e2d55e5186ccda1992763c93 /app/models
parent9f99bf3b0e3516471806f3595e1619b8e9af2a80 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models')
-rw-r--r--app/models/application_setting.rb2
-rw-r--r--app/models/ci/job_token/scope.rb4
-rw-r--r--app/models/concerns/cross_database_modification.rb2
-rw-r--r--app/models/main_clusterwide/application_record.rb11
-rw-r--r--app/models/packages/debian.rb2
-rw-r--r--app/models/preloaders/user_max_access_level_in_projects_preloader.rb4
6 files changed, 19 insertions, 6 deletions
diff --git a/app/models/application_setting.rb b/app/models/application_setting.rb
index e1eda95f19c..98adbd3ab06 100644
--- a/app/models/application_setting.rb
+++ b/app/models/application_setting.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-class ApplicationSetting < ApplicationRecord
+class ApplicationSetting < MainClusterwide::ApplicationRecord
include CacheableAttributes
include CacheMarkdownField
include TokenAuthenticatable
diff --git a/app/models/ci/job_token/scope.rb b/app/models/ci/job_token/scope.rb
index 96faf3792d1..20775077bd8 100644
--- a/app/models/ci/job_token/scope.rb
+++ b/app/models/ci/job_token/scope.rb
@@ -59,8 +59,8 @@ module Ci
def inbound_accessible?(accessed_project)
# if the flag or setting is disabled any project is considered to be in scope.
- return true unless Feature.enabled?(:ci_inbound_job_token_scope, current_project)
- return true unless current_project.ci_inbound_job_token_scope_enabled?
+ return true unless Feature.enabled?(:ci_inbound_job_token_scope, accessed_project)
+ return true unless accessed_project.ci_inbound_job_token_scope_enabled?
inbound_linked_as_accessible?(accessed_project)
end
diff --git a/app/models/concerns/cross_database_modification.rb b/app/models/concerns/cross_database_modification.rb
index 273d5f35e76..a20bd640e21 100644
--- a/app/models/concerns/cross_database_modification.rb
+++ b/app/models/concerns/cross_database_modification.rb
@@ -102,6 +102,8 @@ module CrossDatabaseModification
:gitlab_main
when 'Ci::ApplicationRecord'
:gitlab_ci
+ when 'MainClusterwide::ApplicationRecord'
+ :gitlab_main_clusterwide
else
Gitlab::Database::GitlabSchema.table_schema(table_name) if table_name
end
diff --git a/app/models/main_clusterwide/application_record.rb b/app/models/main_clusterwide/application_record.rb
new file mode 100644
index 00000000000..dc61ea695c8
--- /dev/null
+++ b/app/models/main_clusterwide/application_record.rb
@@ -0,0 +1,11 @@
+# frozen_string_literal: true
+
+module MainClusterwide
+ class ApplicationRecord < ::ApplicationRecord
+ self.abstract_class = true
+
+ if Gitlab::Database.has_config?(:main_clusterwide)
+ connects_to database: { writing: :main_clusterwide, reading: :main_clusterwide }
+ end
+ end
+end
diff --git a/app/models/packages/debian.rb b/app/models/packages/debian.rb
index 2daafe0ebcf..9c615c20250 100644
--- a/app/models/packages/debian.rb
+++ b/app/models/packages/debian.rb
@@ -2,6 +2,8 @@
module Packages
module Debian
+ TEMPORARY_PACKAGE_NAME = 'debian-temporary-package'
+
DISTRIBUTION_REGEX = %r{[a-z0-9][a-z0-9.-]*}i.freeze
COMPONENT_REGEX = DISTRIBUTION_REGEX.freeze
ARCHITECTURE_REGEX = %r{[a-z0-9][-a-z0-9]*}.freeze
diff --git a/app/models/preloaders/user_max_access_level_in_projects_preloader.rb b/app/models/preloaders/user_max_access_level_in_projects_preloader.rb
index c9fd5e7718a..09854ec5ff1 100644
--- a/app/models/preloaders/user_max_access_level_in_projects_preloader.rb
+++ b/app/models/preloaders/user_max_access_level_in_projects_preloader.rb
@@ -7,12 +7,10 @@ module Preloaders
def initialize(projects, user)
@projects = if projects.is_a?(Array)
Project.where(id: projects)
- elsif Feature.enabled?(:projects_preloader_fix)
+ else
# Push projects base query in to a sub-select to avoid
# table name clashes. Performs better than aliasing.
Project.where(id: projects.subquery(:id))
- else
- Project.where(id: projects.reselect(:id))
end
@user = user