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-10-05 06:08:14 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-10-05 06:08:14 +0300
commitfdb5a6d73c634c2545cd2cb70cdc0a3b1458c712 (patch)
tree53443e41b232b4aa7ec000e265df5dd2152b94cf /app
parentf11cce04caba6363b1e8d33989e5671819d1d502 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app')
-rw-r--r--app/components/pajamas/banner_component.html.haml36
-rw-r--r--app/controllers/projects/application_controller.rb2
-rw-r--r--app/models/integrations/jira.rb88
-rw-r--r--app/models/loose_foreign_keys/deleted_record.rb34
-rw-r--r--app/models/project.rb4
-rw-r--r--app/services/projects/after_rename_service.rb2
-rw-r--r--app/services/projects/hashed_storage/migrate_repository_service.rb2
-rw-r--r--app/workers/all_queues.yml9
-rw-r--r--app/workers/gitlab_shell_worker.rb23
9 files changed, 91 insertions, 109 deletions
diff --git a/app/components/pajamas/banner_component.html.haml b/app/components/pajamas/banner_component.html.haml
index 8a177edddb5..ebb88b305dc 100644
--- a/app/components/pajamas/banner_component.html.haml
+++ b/app/components/pajamas/banner_component.html.haml
@@ -1,22 +1,26 @@
-%section.gl-banner{ @banner_options, class: banner_class }
- - if illustration?
- .gl-banner-illustration
- = illustration
- - elsif @svg_path.present?
- .gl-banner-illustration
- = image_tag @svg_path, alt: ""
+-# This is using gl-card classes to match Vue component
+-# Here's the issue to refactor away from gl-card
+-# https://gitlab.com/gitlab-org/gitlab-ui/-/issues/2324
+.gl-banner.gl-card.gl-pl-6.gl-pr-8.gl-py-6{ @banner_options, class: banner_class }
+ .gl-display-flex
+ - if illustration?
+ .gl-banner-illustration
+ = illustration
+ - elsif @svg_path.present?
+ .gl-banner-illustration
+ = image_tag @svg_path, alt: ""
- .gl-banner-content
- %h1.gl-banner-title= title
+ .gl-banner-content
+ %h1.gl-banner-title= title
- = content
+ = content
- - if primary_action?
- = primary_action
- - else
- = link_button_to @button_text, @button_link, **@button_options, class: 'js-close-callout', variant: :confirm
+ - if primary_action?
+ = primary_action
+ - else
+ = link_button_to @button_text, @button_link, **@button_options, class: 'js-close-callout', variant: :confirm
- - actions.each do |action|
- = action
+ - actions.each do |action|
+ = action
= render Pajamas::ButtonComponent.new(category: :tertiary, variant: close_button_variant, size: :small, icon: 'close', button_options: @close_options)
diff --git a/app/controllers/projects/application_controller.rb b/app/controllers/projects/application_controller.rb
index 62233c8c3c9..30c6f4d865a 100644
--- a/app/controllers/projects/application_controller.rb
+++ b/app/controllers/projects/application_controller.rb
@@ -85,7 +85,7 @@ class Projects::ApplicationController < ApplicationController
end
def require_pages_enabled!
- not_found unless @project.pages_available?
+ not_found unless ::Gitlab::Pages.enabled?
end
def check_issues_available!
diff --git a/app/models/integrations/jira.rb b/app/models/integrations/jira.rb
index d8d1f860e9a..a08f826ed23 100644
--- a/app/models/integrations/jira.rb
+++ b/app/models/integrations/jira.rb
@@ -11,8 +11,12 @@ module Integrations
PROJECTS_PER_PAGE = 50
JIRA_CLOUD_HOST = '.atlassian.net'
- ATLASSIAN_REFERRER_GITLAB_COM = { atlOrigin: 'eyJpIjoiY2QyZTJiZDRkNGZhNGZlMWI3NzRkNTBmZmVlNzNiZTkiLCJwIjoianN3LWdpdGxhYi1pbnQifQ' }.freeze
- ATLASSIAN_REFERRER_SELF_MANAGED = { atlOrigin: 'eyJpIjoiYjM0MTA4MzUyYTYxNDVkY2IwMzVjOGQ3ZWQ3NzMwM2QiLCJwIjoianN3LWdpdGxhYlNNLWludCJ9' }.freeze
+ ATLASSIAN_REFERRER_GITLAB_COM = {
+ atlOrigin: 'eyJpIjoiY2QyZTJiZDRkNGZhNGZlMWI3NzRkNTBmZmVlNzNiZTkiLCJwIjoianN3LWdpdGxhYi1pbnQifQ'
+ }.freeze
+ ATLASSIAN_REFERRER_SELF_MANAGED = {
+ atlOrigin: 'eyJpIjoiYjM0MTA4MzUyYTYxNDVkY2IwMzVjOGQ3ZWQ3NzMwM2QiLCJwIjoianN3LWdpdGxhYlNNLWludCJ9'
+ }.freeze
API_ENDPOINTS = {
find_issue: "/rest/api/2/issue/%s",
@@ -28,11 +32,13 @@ module Integrations
AUTH_TYPE_BASIC = 0
AUTH_TYPE_PAT = 1
- SNOWPLOW_EVENT_CATEGORY = self.name
+ SNOWPLOW_EVENT_CATEGORY = name
validates :url, public_url: true, presence: true, if: :activated?
validates :api_url, public_url: true, allow_blank: true
- validates :username, presence: true, if: ->(object) { object.activated? && !object.personal_access_token_authorization? }
+ validates :username, presence: true, if: ->(object) {
+ object.activated? && !object.personal_access_token_authorization?
+ }
validates :password, presence: true, if: :activated?
validates :jira_auth_type, presence: true, inclusion: { in: [AUTH_TYPE_BASIC, AUTH_TYPE_PAT] }, if: :activated?
validates :jira_issue_prefix, untrusted_regexp: true, length: { maximum: 255 }, if: :activated?
@@ -130,7 +136,7 @@ module Integrations
end
# {PROJECT-KEY}-{NUMBER} Examples: JIRA-1, PROJECT-1
- def reference_pattern(only_long: true)
+ def reference_pattern(*)
@reference_pattern ||= jira_issue_match_regex
end
@@ -144,7 +150,7 @@ module Integrations
end
def data_fields
- jira_tracker_data || self.build_jira_tracker_data
+ jira_tracker_data || build_jira_tracker_data
end
def set_default_data
@@ -186,8 +192,13 @@ module Integrations
end
def help
- jira_doc_link_start = '<a href="%{url}" target="_blank" rel="noopener noreferrer">'.html_safe % { url: help_page_path('integration/jira/index') }
- s_("JiraService|You must configure Jira before enabling this integration. %{jira_doc_link_start}Learn more.%{link_end}") % { jira_doc_link_start: jira_doc_link_start, link_end: '</a>'.html_safe }
+ jira_doc_link_start = format('<a href="%{url}" target="_blank" rel="noopener noreferrer">'.html_safe,
+ url: help_page_path('integration/jira/index'))
+ format(
+ s_("JiraService|You must configure Jira before enabling this integration. " \
+ "%{jira_doc_link_start}Learn more.%{link_end}"),
+ jira_doc_link_start: jira_doc_link_start,
+ link_end: '</a>'.html_safe)
end
def title
@@ -212,7 +223,8 @@ module Integrations
{
type: SECTION_TYPE_JIRA_TRIGGER,
title: _('Trigger'),
- description: s_('JiraService|When a Jira issue is mentioned in a commit or merge request, a remote link and comment (if enabled) will be created.')
+ description: s_('JiraService|When a Jira issue is mentioned in a commit or merge request, a remote link ' \
+ 'and comment (if enabled) will be created.')
},
{
type: SECTION_TYPE_CONFIGURATION,
@@ -313,7 +325,8 @@ module Integrations
override :create_cross_reference_note
def create_cross_reference_note(external_issue, mentioned_in, author)
unless can_cross_reference?(mentioned_in)
- return s_("JiraService|Events for %{noteable_model_name} are disabled.") % { noteable_model_name: mentioned_in.model_name.plural.humanize(capitalize: false) }
+ return format(s_("JiraService|Events for %{noteable_model_name} are disabled."),
+ noteable_model_name: mentioned_in.model_name.plural.humanize(capitalize: false))
end
jira_issue = find_issue(external_issue.id)
@@ -398,10 +411,9 @@ module Integrations
end
def server_info
- strong_memoize(:server_info) do
- client_url.present? ? jira_request(API_ENDPOINTS[:server_info]) { client.ServerInfo.all.attrs } : nil
- end
+ client_url.present? ? jira_request(API_ENDPOINTS[:server_info]) { client.ServerInfo.all.attrs } : nil
end
+ strong_memoize_attr :server_info
def can_cross_reference?(mentioned_in)
case mentioned_in
@@ -430,7 +442,8 @@ module Integrations
true
rescue StandardError => e
path = API_ENDPOINTS[:transition_issue] % issue.id
- log_exception(e, message: 'Issue transition failed', client_url: client_url, client_path: path, client_status: '400')
+ log_exception(e, message: 'Issue transition failed', client_url: client_url, client_path: path,
+ client_status: '400')
false
end
@@ -488,9 +501,9 @@ module Integrations
link_title = "#{entity_name.capitalize} - #{entity_title}"
link_props = build_remote_link_props(url: entity_url, title: link_title)
- unless comment_exists?(issue, message)
- send_message(issue, message, link_props)
- end
+ return if comment_exists?(issue, message)
+
+ send_message(issue, message, link_props)
end
def comment_message(data)
@@ -503,21 +516,22 @@ module Integrations
project_link = build_jira_link(project.full_name, Gitlab::Routing.url_helpers.project_url(project))
branch =
if entity[:branch].present?
- s_('JiraService| on branch %{branch_link}') % {
- branch_link: build_jira_link(entity[:branch], project_tree_url(project, entity[:branch]))
- }
+ format(s_('JiraService| on branch %{branch_link}'),
+ branch_link: build_jira_link(entity[:branch], project_tree_url(project, entity[:branch])))
end
entity_message = entity[:description].presence if all_details?
entity_message ||= entity[:title].chomp
- s_('JiraService|%{user_link} mentioned this issue in %{entity_link} of %{project_link}%{branch}:{quote}%{entity_message}{quote}') % {
+ format(
+ s_('JiraService|%{user_link} mentioned this issue in %{entity_link} of ' \
+ '%{project_link}%{branch}:{quote}%{entity_message}{quote}'),
user_link: user_link,
entity_link: entity_link,
project_link: project_link,
branch: branch,
entity_message: entity_message
- }
+ )
end
def build_jira_link(title, url)
@@ -586,13 +600,13 @@ module Integrations
end
def resource_url(resource)
- "#{Settings.gitlab.base_url.chomp("/")}#{resource}"
+ "#{Settings.gitlab.base_url.chomp('/')}#{resource}"
end
def build_entity_url(entity_type, entity_id)
polymorphic_url(
[
- self.project,
+ project,
entity_type.to_sym
],
id: entity_id,
@@ -631,7 +645,8 @@ module Integrations
yield
rescue StandardError => e
@error = e
- log_exception(e, message: 'Error sending message', client_url: client_url, client_path: path, client_status: e.try(:code))
+ log_exception(e, message: 'Error sending message', client_url: client_url, client_path: path,
+ client_status: e.try(:code))
nil
end
@@ -648,7 +663,8 @@ module Integrations
results = server_info
unless results.present?
- Gitlab::AppLogger.warn(message: "Jira API returned no ServerInfo, setting deployment_type from URL", server_info: results, url: client_url)
+ Gitlab::AppLogger.warn(message: "Jira API returned no ServerInfo, setting deployment_type from URL",
+ server_info: results, url: client_url)
return set_deployment_type_from_url
end
@@ -681,13 +697,25 @@ module Integrations
end
def jira_issues_section_description
- jira_issues_link_start = '<a href="%{url}" target="_blank" rel="noopener noreferrer">'.html_safe % { url: help_page_path('integration/jira/issues') }
- description = s_('JiraService|Work on Jira issues without leaving GitLab. Add a Jira menu to access a read-only list of your Jira issues. %{jira_issues_link_start}Learn more.%{link_end}') % { jira_issues_link_start: jira_issues_link_start, link_end: '</a>'.html_safe }
+ jira_issues_link_start = format('<a href="%{url}" target="_blank" rel="noopener noreferrer">'.html_safe,
+ url: help_page_path('integration/jira/issues'))
+ description = format(
+ s_('JiraService|Work on Jira issues without leaving GitLab. Add a Jira menu to access a read-only list of ' \
+ 'your Jira issues. %{jira_issues_link_start}Learn more.%{link_end}'),
+ jira_issues_link_start: jira_issues_link_start,
+ link_end: '</a>'.html_safe
+ )
if project&.issues_enabled?
- gitlab_issues_link_start = '<a href="%{url}">'.html_safe % { url: edit_project_path(project, anchor: 'js-shared-permissions') }
+ gitlab_issues_link_start = format('<a href="%{url}">'.html_safe, url: edit_project_path(project,
+ anchor: 'js-shared-permissions'))
description += '<br><br>'.html_safe
- description += s_("JiraService|Displaying Jira issues while leaving GitLab issues also enabled might be confusing. Consider %{gitlab_issues_link_start}disabling GitLab issues%{link_end} if they won't otherwise be used.") % { gitlab_issues_link_start: gitlab_issues_link_start, link_end: '</a>'.html_safe }
+ description += format(
+ s_("JiraService|Displaying Jira issues while leaving GitLab issues also enabled might be confusing. " \
+ "Consider %{gitlab_issues_link_start}disabling GitLab issues%{link_end} if they won't otherwise be used."),
+ gitlab_issues_link_start: gitlab_issues_link_start,
+ link_end: '</a>'.html_safe
+ )
end
description
diff --git a/app/models/loose_foreign_keys/deleted_record.rb b/app/models/loose_foreign_keys/deleted_record.rb
index 1d26c3c11e4..6af80686ec2 100644
--- a/app/models/loose_foreign_keys/deleted_record.rb
+++ b/app/models/loose_foreign_keys/deleted_record.rb
@@ -36,34 +36,24 @@ class LooseForeignKeys::DeletedRecord < Gitlab::Database::SharedModel
enum status: { pending: 1, processed: 2 }, _prefix: :status
def self.load_batch_for_table(table, batch_size)
- if Feature.enabled?("loose_foreign_keys_batch_load_using_union")
- partition_names = Gitlab::Database::PostgresPartitionedTable.each_partition(table_name).map(&:name)
-
- unions = partition_names.map do |partition_name|
- partition_number = partition_name[/\d+/].to_i
-
- select(arel_table[Arel.star], arel_table[:partition].as('partition_number'))
- .from("#{Gitlab::Database::DYNAMIC_PARTITIONS_SCHEMA}.#{partition_name} AS #{table_name}")
- .for_table(table)
- .where(partition: partition_number)
- .status_pending
- .consume_order
- .limit(batch_size)
- end
-
- select(arel_table[Arel.star])
- .from_union(unions, remove_duplicates: false, remove_order: false)
- .limit(batch_size)
- .to_a
- else
- # selecting partition as partition_number to workaround the sliding partitioning column ignore
+ partition_names = Gitlab::Database::PostgresPartitionedTable.each_partition(table_name).map(&:name)
+
+ unions = partition_names.map do |partition_name|
+ partition_number = partition_name[/\d+/].to_i
+
select(arel_table[Arel.star], arel_table[:partition].as('partition_number'))
+ .from("#{Gitlab::Database::DYNAMIC_PARTITIONS_SCHEMA}.#{partition_name} AS #{table_name}")
.for_table(table)
+ .where(partition: partition_number)
.status_pending
.consume_order
.limit(batch_size)
- .to_a
end
+
+ select(arel_table[Arel.star])
+ .from_union(unions, remove_duplicates: false, remove_order: false)
+ .limit(batch_size)
+ .to_a
end
def self.mark_records_processed(records)
diff --git a/app/models/project.rb b/app/models/project.rb
index d614c96990e..55cdad1dd94 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -2244,10 +2244,6 @@ class Project < ApplicationRecord
File.join(Settings.pages.path, full_path)
end
- def pages_available?
- Gitlab.config.pages.enabled
- end
-
def pages_show_onboarding?
!(pages_metadatum&.onboarding_complete || pages_metadatum&.deployed)
end
diff --git a/app/services/projects/after_rename_service.rb b/app/services/projects/after_rename_service.rb
index 9dc957b5be2..bbb812fd7be 100644
--- a/app/services/projects/after_rename_service.rb
+++ b/app/services/projects/after_rename_service.rb
@@ -147,5 +147,3 @@ module Projects
end
end
end
-
-Projects::AfterRenameService.prepend_mod_with('Projects::AfterRenameService')
diff --git a/app/services/projects/hashed_storage/migrate_repository_service.rb b/app/services/projects/hashed_storage/migrate_repository_service.rb
index b65d0e63fd3..b3de9d78cb8 100644
--- a/app/services/projects/hashed_storage/migrate_repository_service.rb
+++ b/app/services/projects/hashed_storage/migrate_repository_service.rb
@@ -51,5 +51,3 @@ module Projects
end
end
end
-
-Projects::HashedStorage::MigrateRepositoryService.prepend_mod_with('Projects::HashedStorage::MigrateRepositoryService')
diff --git a/app/workers/all_queues.yml b/app/workers/all_queues.yml
index f39c5f5c232..01f62be505b 100644
--- a/app/workers/all_queues.yml
+++ b/app/workers/all_queues.yml
@@ -2973,15 +2973,6 @@
:weight: 1
:idempotent: true
:tags: []
-- :name: gitlab_shell
- :worker_name: GitlabShellWorker
- :feature_category: :source_code_management
- :has_external_dependencies: false
- :urgency: :high
- :resource_boundary: :unknown
- :weight: 2
- :idempotent: false
- :tags: []
- :name: google_cloud_create_cloudsql_instance
:worker_name: GoogleCloud::CreateCloudsqlInstanceWorker
:feature_category: :not_owned
diff --git a/app/workers/gitlab_shell_worker.rb b/app/workers/gitlab_shell_worker.rb
deleted file mode 100644
index af657cb3dbd..00000000000
--- a/app/workers/gitlab_shell_worker.rb
+++ /dev/null
@@ -1,23 +0,0 @@
-# frozen_string_literal: true
-
-class GitlabShellWorker # rubocop:disable Scalability/IdempotentWorker
- include ApplicationWorker
-
- data_consistency :always
-
- sidekiq_options retry: 3
- include Gitlab::ShellAdapter
-
- feature_category :source_code_management
- urgency :high
- weight 2
- loggable_arguments 0
-
- def perform(action, *arg)
- if Gitlab::Shell::PERMITTED_ACTIONS.exclude?(action)
- raise(ArgumentError, "#{action} not allowed for #{self.class.name}")
- end
-
- gitlab_shell.public_send(action, *arg) # rubocop:disable GitlabSecurity/PublicSend
- end
-end