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
path: root/app
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-02-21 00:11:36 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-02-21 00:11:36 +0300
commit61a1cd3b8389a7f5553bae90655710ed9b39ddff (patch)
tree52b9e65c4dbf1baf63a8ef52edc79f3eedfbf0d1 /app
parent72c050db64bd61ae767f47c4fa2bc97b94a67592 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app')
-rw-r--r--app/helpers/application_settings_helper.rb1
-rw-r--r--app/models/application_setting.rb5
-rw-r--r--app/models/ci/runner_machine_build.rb4
-rw-r--r--app/models/namespace.rb8
-rw-r--r--app/models/user.rb1
-rw-r--r--app/policies/concerns/archived_abilities.rb1
6 files changed, 16 insertions, 4 deletions
diff --git a/app/helpers/application_settings_helper.rb b/app/helpers/application_settings_helper.rb
index 3abaae98c29..59ba5fa65d3 100644
--- a/app/helpers/application_settings_helper.rb
+++ b/app/helpers/application_settings_helper.rb
@@ -248,6 +248,7 @@ module ApplicationSettingsHelper
:default_project_visibility,
:default_projects_limit,
:default_snippet_visibility,
+ :default_syntax_highlighting_theme,
:delete_inactive_projects,
:disable_admin_oauth_scopes,
:disable_feed_token,
diff --git a/app/models/application_setting.rb b/app/models/application_setting.rb
index 98adbd3ab06..5319f4aee77 100644
--- a/app/models/application_setting.rb
+++ b/app/models/application_setting.rb
@@ -698,6 +698,11 @@ class ApplicationSetting < MainClusterwide::ApplicationRecord
allow_nil: false,
inclusion: { in: [true, false], message: N_('must be a boolean value') }
+ validates :default_syntax_highlighting_theme,
+ allow_nil: false,
+ numericality: { only_integer: true, greater_than: 0 },
+ inclusion: { in: Gitlab::ColorSchemes.valid_ids, message: N_('must be a valid syntax highlighting theme ID') }
+
before_validation :ensure_uuid!
before_validation :coerce_repository_storages_weighted, if: :repository_storages_weighted_changed?
before_validation :normalize_default_branch_name
diff --git a/app/models/ci/runner_machine_build.rb b/app/models/ci/runner_machine_build.rb
index 2e0a6a76bcc..ac2b258557a 100644
--- a/app/models/ci/runner_machine_build.rb
+++ b/app/models/ci/runner_machine_build.rb
@@ -11,8 +11,8 @@ module Ci
partitionable scope: :build
partitioned_by :partition_id,
strategy: :ci_sliding_list,
- next_partition_if: -> { false },
- detach_partition_if: -> { false }
+ next_partition_if: proc { false },
+ detach_partition_if: proc { false }
belongs_to :build, inverse_of: :runner_machine_build, class_name: 'Ci::Build'
belongs_to :runner_machine, inverse_of: :runner_machine_builds, class_name: 'Ci::RunnerMachine'
diff --git a/app/models/namespace.rb b/app/models/namespace.rb
index 252fb9aa308..b136c0ffac2 100644
--- a/app/models/namespace.rb
+++ b/app/models/namespace.rb
@@ -286,11 +286,15 @@ class Namespace < ApplicationRecord
end
def any_project_has_container_registry_tags?
- all_projects.includes(:container_repositories).any?(&:has_container_registry_tags?)
+ first_project_with_container_registry_tags.present?
end
def first_project_with_container_registry_tags
- all_projects.find(&:has_container_registry_tags?)
+ if Gitlab.com? && Feature.enabled?(:use_sub_repositories_api)
+ ContainerRegistry::GitlabApiClient.one_project_with_container_registry_tag(full_path)
+ else
+ all_projects.includes(:container_repositories).find(&:has_container_registry_tags?)
+ end
end
def send_update_instructions
diff --git a/app/models/user.rb b/app/models/user.rb
index f3e8f14adf5..9a9530c4d3a 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -71,6 +71,7 @@ class User < ApplicationRecord
attribute :notified_of_own_activity, default: false
attribute :preferred_language, default: -> { Gitlab::CurrentSettings.default_preferred_language }
attribute :theme_id, default: -> { gitlab_config.default_theme }
+ attribute :color_scheme_id, default: -> { Gitlab::CurrentSettings.default_syntax_highlighting_theme }
attr_encrypted :otp_secret,
key: Gitlab::Application.secrets.otp_key_base,
diff --git a/app/policies/concerns/archived_abilities.rb b/app/policies/concerns/archived_abilities.rb
index b4dfad599c7..7d61f83528e 100644
--- a/app/policies/concerns/archived_abilities.rb
+++ b/app/policies/concerns/archived_abilities.rb
@@ -37,6 +37,7 @@ module ArchivedAbilities
pages
cluster
release
+ timelog
].freeze
class_methods do