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-09-26 12:11:27 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-09-26 12:11:27 +0300
commit576bba90f9b4b4fdd604871805469f57c147e07c (patch)
treee3c3bef2505f1fd1fc5e3b9928566a3ca0b9682b /app
parent403b33efdbc038a6bd42a50970e0985b385f73d7 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app')
-rw-r--r--app/assets/javascripts/super_sidebar/components/super_sidebar_toggle.vue60
-rw-r--r--app/assets/javascripts/super_sidebar/components/user_bar.vue3
-rw-r--r--app/controllers/import/bulk_imports_controller.rb2
-rw-r--r--app/controllers/import/fogbugz_controller.rb2
-rw-r--r--app/controllers/import/gitea_controller.rb2
-rw-r--r--app/graphql/types/ci/detailed_status_type.rb24
-rw-r--r--app/models/abuse_report.rb2
-rw-r--r--app/models/application_record.rb2
-rw-r--r--app/models/application_setting.rb2
-rw-r--r--app/models/clusters/concerns/prometheus_client.rb2
-rw-r--r--app/models/clusters/platforms/kubernetes.rb2
-rw-r--r--app/models/concerns/reset_on_column_errors.rb46
-rw-r--r--app/models/concerns/reset_on_union_error.rb37
-rw-r--r--app/models/service_desk/custom_email_credential.rb2
-rw-r--r--app/models/ssh_host_key.rb2
-rw-r--r--app/models/users/in_product_marketing_email.rb6
-rw-r--r--app/services/clusters/cleanup/project_namespace_service.rb2
-rw-r--r--app/services/clusters/cleanup/service_account_service.rb2
-rw-r--r--app/services/projects/import_service.rb4
-rw-r--r--app/validators/addressable_url_validator.rb2
-rw-r--r--app/views/layouts/nav/_top_bar.html.haml2
-rw-r--r--app/workers/integrations/irker_worker.rb2
22 files changed, 124 insertions, 86 deletions
diff --git a/app/assets/javascripts/super_sidebar/components/super_sidebar_toggle.vue b/app/assets/javascripts/super_sidebar/components/super_sidebar_toggle.vue
index 30ee18cc369..049a61e17c7 100644
--- a/app/assets/javascripts/super_sidebar/components/super_sidebar_toggle.vue
+++ b/app/assets/javascripts/super_sidebar/components/super_sidebar_toggle.vue
@@ -14,59 +14,75 @@ export default {
},
mixins: [Tracking.mixin()],
props: {
- tooltipContainer: {
+ type: {
type: String,
required: false,
- default: null,
- },
- tooltipPlacement: {
- type: String,
- required: false,
- default: 'right',
+ default: 'expand',
},
},
i18n: {
- collapseSidebar: __('Hide sidebar'),
- expandSidebar: __('Keep sidebar visible'),
primaryNavigationSidebar: __('Primary navigation sidebar'),
},
+ tooltipCollapse: {
+ placement: 'bottom',
+ container: 'super-sidebar',
+ title: __('Hide sidebar'),
+ },
+ tooltipExpand: {
+ placement: 'right',
+ title: __('Keep sidebar visible'),
+ },
data() {
return sidebarState;
},
computed: {
- canOpen() {
- return this.isCollapsed || this.isPeek || this.isHoverPeek;
+ isTypeCollapse() {
+ return this.type === 'collapse';
},
- tooltipTitle() {
- return this.canOpen ? this.$options.i18n.expandSidebar : this.$options.i18n.collapseSidebar;
+ isTypeExpand() {
+ return this.type === 'expand';
},
tooltip() {
- return {
- placement: this.tooltipPlacement,
- container: this.tooltipContainer,
- title: this.tooltipTitle,
- };
+ return this.isTypeExpand ? this.$options.tooltipExpand : this.$options.tooltipCollapse;
},
ariaExpanded() {
- return String(!this.canOpen);
+ return String(this.isTypeCollapse);
},
},
+ mounted() {
+ this.$root.$on('bv::tooltip::show', this.onTooltipShow);
+ },
+ beforeUnmount() {
+ this.$root.$off('bv::tooltip::show', this.onTooltipShow);
+ },
methods: {
toggle() {
- this.track(this.canOpen ? 'nav_show' : 'nav_hide', {
+ this.track(this.isTypeExpand ? 'nav_show' : 'nav_hide', {
label: 'nav_toggle',
property: 'nav_sidebar',
});
- toggleSuperSidebarCollapsed(!this.canOpen, true);
+ toggleSuperSidebarCollapsed(!this.isTypeExpand, true);
this.focusOtherToggle();
},
focusOtherToggle() {
this.$nextTick(() => {
- const classSelector = this.canOpen ? JS_TOGGLE_EXPAND_CLASS : JS_TOGGLE_COLLAPSE_CLASS;
+ const classSelector = this.isTypeExpand ? JS_TOGGLE_COLLAPSE_CLASS : JS_TOGGLE_EXPAND_CLASS;
const otherToggle = document.querySelector(`.${classSelector}`);
otherToggle?.focus();
});
},
+ onTooltipShow(bvEvent) {
+ if (
+ bvEvent.target !== this.$el ||
+ (this.isTypeCollapse && !this.isCollapsed) ||
+ (this.isTypeExpand && this.isCollapsed) ||
+ this.isPeek ||
+ this.isHoverPeek
+ )
+ return;
+
+ bvEvent.preventDefault();
+ },
},
};
</script>
diff --git a/app/assets/javascripts/super_sidebar/components/user_bar.vue b/app/assets/javascripts/super_sidebar/components/user_bar.vue
index 49aee4f3470..ea634d43a96 100644
--- a/app/assets/javascripts/super_sidebar/components/user_bar.vue
+++ b/app/assets/javascripts/super_sidebar/components/user_bar.vue
@@ -126,9 +126,8 @@ export default {
<super-sidebar-toggle
v-if="hasCollapseButton"
:class="$options.JS_TOGGLE_COLLAPSE_CLASS"
- tooltip-placement="bottom"
- tooltip-container="super-sidebar"
data-testid="super-sidebar-collapse-button"
+ type="collapse"
/>
<create-menu
v-if="sidebarData.is_logged_in && sidebarData.create_new_menu_groups.length > 0"
diff --git a/app/controllers/import/bulk_imports_controller.rb b/app/controllers/import/bulk_imports_controller.rb
index d7d7ad84bc8..a8ec738caf4 100644
--- a/app/controllers/import/bulk_imports_controller.rb
+++ b/app/controllers/import/bulk_imports_controller.rb
@@ -152,7 +152,7 @@ class Import::BulkImportsController < ApplicationController
allow_local_network: allow_local_requests?,
schemes: %w[http https]
)
- rescue Gitlab::UrlBlocker::BlockedUrlError => e
+ rescue Gitlab::HTTP_V2::UrlBlocker::BlockedUrlError => e
clear_session_data
redirect_to new_group_path(anchor: 'import-group-pane'), alert: _('Specified URL cannot be used: "%{reason}"') % { reason: e.message }
diff --git a/app/controllers/import/fogbugz_controller.rb b/app/controllers/import/fogbugz_controller.rb
index 9ee8e59053f..34fdf513313 100644
--- a/app/controllers/import/fogbugz_controller.rb
+++ b/app/controllers/import/fogbugz_controller.rb
@@ -128,7 +128,7 @@ class Import::FogbugzController < Import::BaseController
allow_local_network: allow_local_requests?,
schemes: %w[http https]
)
- rescue Gitlab::UrlBlocker::BlockedUrlError => e
+ rescue Gitlab::HTTP_V2::UrlBlocker::BlockedUrlError => e
redirect_to new_import_fogbugz_url, alert: _('Specified URL cannot be used: "%{reason}"') % { reason: e.message }
end
diff --git a/app/controllers/import/gitea_controller.rb b/app/controllers/import/gitea_controller.rb
index 2778b97419a..a7497710dc0 100644
--- a/app/controllers/import/gitea_controller.rb
+++ b/app/controllers/import/gitea_controller.rb
@@ -99,7 +99,7 @@ class Import::GiteaController < Import::GithubController
allow_local_network: allow_local_requests?,
schemes: %w[http https]
)
- rescue Gitlab::UrlBlocker::BlockedUrlError => e
+ rescue Gitlab::HTTP_V2::UrlBlocker::BlockedUrlError => e
session[access_token_key] = nil
redirect_to new_import_url, alert: _('Specified URL cannot be used: "%{reason}"') % { reason: e.message }
diff --git a/app/graphql/types/ci/detailed_status_type.rb b/app/graphql/types/ci/detailed_status_type.rb
index e18770c2708..6882a495259 100644
--- a/app/graphql/types/ci/detailed_status_type.rb
+++ b/app/graphql/types/ci/detailed_status_type.rb
@@ -16,20 +16,34 @@ module Types
field :favicon, GraphQL::Types::String, null: true,
description: 'Favicon of the status.'
field :group, GraphQL::Types::String, null: true,
- description: 'Group of the status.'
+ description: 'Group of the status.',
+ deprecated: {
+ reason: 'The `group` attribute is deprecated. Use `name` instead',
+ milestone: '16.4'
+ }
field :has_details, GraphQL::Types::Boolean, null: true,
description: 'Indicates if the status has further details.',
method: :has_details?
field :icon, GraphQL::Types::String, null: true,
- description: 'Icon of the status.'
+ description: 'Icon of the status.',
+ deprecated: {
+ reason: 'The `icon` attribute is deprecated. Use `name` to ' \
+ 'identify the status to display instead',
+ milestone: '16.4'
+ }
field :id, GraphQL::Types::String, null: false,
description: 'ID for a detailed status.',
extras: [:parent]
field :label, GraphQL::Types::String, null: true,
- calls_gitaly: true,
- description: 'Label of the status.'
+ description: 'Human-readable label of the status (e.g. success).'
+ field :name, GraphQL::Types::String, null: true,
+ description: 'Machine-readable status name (e.g. SUCCESS).'
field :text, GraphQL::Types::String, null: true,
- description: 'Text of the status.'
+ description: 'Text of the status.',
+ deprecated: {
+ reason: 'The `text` attribute is being deprecated. Use `label` instead',
+ milestone: '16.4'
+ }
field :tooltip, GraphQL::Types::String, null: true,
description: 'Tooltip associated with the status.',
method: :status_tooltip
diff --git a/app/models/abuse_report.rb b/app/models/abuse_report.rb
index bf25c539830..adaa057098f 100644
--- a/app/models/abuse_report.rb
+++ b/app/models/abuse_report.rb
@@ -200,7 +200,7 @@ class AbuseReport < ApplicationRecord
format(_('contains URLs that exceed the %{limit} character limit'), limit: MAX_CHAR_LIMIT_URL)
)
end
- rescue ::Gitlab::UrlBlocker::BlockedUrlError
+ rescue ::Gitlab::HTTP_V2::UrlBlocker::BlockedUrlError
errors.add(:links_to_spam, _('only supports valid HTTP(S) URLs'))
end
diff --git a/app/models/application_record.rb b/app/models/application_record.rb
index 7058bfd5650..15e44296635 100644
--- a/app/models/application_record.rb
+++ b/app/models/application_record.rb
@@ -6,7 +6,7 @@ class ApplicationRecord < ActiveRecord::Base
include LegacyBulkInsert
include CrossDatabaseModification
include SensitiveSerializableHash
- include ResetOnUnionError
+ include ResetOnColumnErrors
self.abstract_class = true
diff --git a/app/models/application_setting.rb b/app/models/application_setting.rb
index 153257636ba..8ddb2ead37e 100644
--- a/app/models/application_setting.rb
+++ b/app/models/application_setting.rb
@@ -970,7 +970,7 @@ class ApplicationSetting < MainClusterwide::ApplicationRecord
def parsed_kroki_url
@parsed_kroki_url ||= Gitlab::UrlBlocker.validate!(kroki_url, schemes: %w[http https], enforce_sanitization: true)[0]
- rescue Gitlab::UrlBlocker::BlockedUrlError => e
+ rescue Gitlab::HTTP_V2::UrlBlocker::BlockedUrlError => e
self.errors.add(
:kroki_url,
"is not valid. #{e}"
diff --git a/app/models/clusters/concerns/prometheus_client.rb b/app/models/clusters/concerns/prometheus_client.rb
index d2f69b813aa..b4234e9cc0a 100644
--- a/app/models/clusters/concerns/prometheus_client.rb
+++ b/app/models/clusters/concerns/prometheus_client.rb
@@ -35,7 +35,7 @@ module Clusters
def configured?
kube_client.present? && available?
- rescue Gitlab::UrlBlocker::BlockedUrlError
+ rescue Gitlab::HTTP_V2::UrlBlocker::BlockedUrlError
false
end
diff --git a/app/models/clusters/platforms/kubernetes.rb b/app/models/clusters/platforms/kubernetes.rb
index 5efbec45561..6ae0cd8e3fd 100644
--- a/app/models/clusters/platforms/kubernetes.rb
+++ b/app/models/clusters/platforms/kubernetes.rb
@@ -12,7 +12,7 @@ module Clusters
REQUIRED_K8S_MIN_VERSION = 23
IGNORED_CONNECTION_EXCEPTIONS = [
- Gitlab::UrlBlocker::BlockedUrlError,
+ Gitlab::HTTP_V2::UrlBlocker::BlockedUrlError,
Kubeclient::HttpError,
Errno::ECONNREFUSED,
URI::InvalidURIError,
diff --git a/app/models/concerns/reset_on_column_errors.rb b/app/models/concerns/reset_on_column_errors.rb
new file mode 100644
index 00000000000..8786b5d4f4b
--- /dev/null
+++ b/app/models/concerns/reset_on_column_errors.rb
@@ -0,0 +1,46 @@
+# frozen_string_literal: true
+
+module ResetOnColumnErrors
+ extend ActiveSupport::Concern
+
+ MAX_RESET_PERIOD = 10.minutes
+
+ included do |base|
+ base.rescue_from ActiveRecord::StatementInvalid, with: :reset_on_union_error
+ base.rescue_from ActiveModel::UnknownAttributeError, with: :reset_on_unknown_attribute_error
+
+ base.class_attribute :previous_reset_columns_from_error
+ end
+
+ class_methods do
+ def do_reset(exception)
+ class_to_be_reset = base_class
+
+ class_to_be_reset.reset_column_information
+ Gitlab::ErrorTracking.log_exception(exception, { reset_model_name: class_to_be_reset.name })
+
+ class_to_be_reset.previous_reset_columns_from_error = Time.current
+ end
+
+ def reset_on_union_error(exception)
+ if exception.message.include?("each UNION query must have the same number of columns") && should_reset?
+ do_reset(exception)
+ end
+
+ raise
+ end
+
+ def should_reset?
+ return false if base_class.previous_reset_columns_from_error? &&
+ base_class.previous_reset_columns_from_error > MAX_RESET_PERIOD.ago
+
+ Feature.enabled?(:reset_column_information_on_statement_invalid, type: :ops)
+ end
+ end
+
+ def reset_on_unknown_attribute_error(exception)
+ self.class.do_reset(exception) if self.class.should_reset?
+
+ raise
+ end
+end
diff --git a/app/models/concerns/reset_on_union_error.rb b/app/models/concerns/reset_on_union_error.rb
deleted file mode 100644
index 42e350b0bed..00000000000
--- a/app/models/concerns/reset_on_union_error.rb
+++ /dev/null
@@ -1,37 +0,0 @@
-# frozen_string_literal: true
-
-module ResetOnUnionError
- extend ActiveSupport::Concern
-
- MAX_RESET_PERIOD = 10.minutes
-
- included do |base|
- base.rescue_from ActiveRecord::StatementInvalid, with: :reset_on_union_error
-
- base.class_attribute :previous_reset_columns_from_error
- end
-
- class_methods do
- def reset_on_union_error(exception)
- if reset_on_statement_invalid?(exception)
- class_to_be_reset = base_class
-
- class_to_be_reset.reset_column_information
- Gitlab::ErrorTracking.log_exception(exception, { reset_model_name: class_to_be_reset.name })
-
- class_to_be_reset.previous_reset_columns_from_error = Time.current
- end
-
- raise
- end
-
- def reset_on_statement_invalid?(exception)
- return false unless exception.message.include?("each UNION query must have the same number of columns")
-
- return false if base_class.previous_reset_columns_from_error? &&
- base_class.previous_reset_columns_from_error > MAX_RESET_PERIOD.ago
-
- Feature.enabled?(:reset_column_information_on_statement_invalid, type: :ops)
- end
- end
-end
diff --git a/app/models/service_desk/custom_email_credential.rb b/app/models/service_desk/custom_email_credential.rb
index 8ccdd6f2261..5986ac8a43f 100644
--- a/app/models/service_desk/custom_email_credential.rb
+++ b/app/models/service_desk/custom_email_credential.rb
@@ -59,7 +59,7 @@ module ServiceDesk
allow_localhost: false,
allow_local_network: false
)
- rescue Gitlab::UrlBlocker::BlockedUrlError => e
+ rescue Gitlab::HTTP_V2::UrlBlocker::BlockedUrlError => e
errors.add(:smtp_address, e)
end
end
diff --git a/app/models/ssh_host_key.rb b/app/models/ssh_host_key.rb
index daa64f4e087..672a6d64127 100644
--- a/app/models/ssh_host_key.rb
+++ b/app/models/ssh_host_key.rb
@@ -157,7 +157,7 @@ class SshHostKey
url.port = url.inferred_port
[url, ip]
- rescue Gitlab::UrlBlocker::BlockedUrlError
+ rescue Gitlab::HTTP_V2::UrlBlocker::BlockedUrlError
raise ArgumentError, "Invalid URL"
end
diff --git a/app/models/users/in_product_marketing_email.rb b/app/models/users/in_product_marketing_email.rb
index f220cfd17c5..a62dfaf02c3 100644
--- a/app/models/users/in_product_marketing_email.rb
+++ b/app/models/users/in_product_marketing_email.rb
@@ -44,16 +44,16 @@ module Users
INACTIVE_TRACK_NAMES = %w[invite_team experience].freeze
ACTIVE_TRACKS = tracks.except(*INACTIVE_TRACK_NAMES)
- scope :for_user_with_track_and_series, -> (user, track, series) do
+ scope :for_user_with_track_and_series, ->(user, track, series) do
where(user: user, track: track, series: series)
end
- scope :without_track_and_series, -> (track, series) do
+ scope :without_track_and_series, ->(track, series) do
join_condition = for_user.and(for_track_and_series(track, series))
users_without_records(join_condition)
end
- scope :without_campaign, -> (campaign) do
+ scope :without_campaign, ->(campaign) do
join_condition = for_user.and(for_campaign(campaign))
users_without_records(join_condition)
end
diff --git a/app/services/clusters/cleanup/project_namespace_service.rb b/app/services/clusters/cleanup/project_namespace_service.rb
index f6ac06d0594..3d5a4f85d10 100644
--- a/app/services/clusters/cleanup/project_namespace_service.rb
+++ b/app/services/clusters/cleanup/project_namespace_service.rb
@@ -40,7 +40,7 @@ module Clusters
cluster.kubeclient&.delete_namespace(kubernetes_namespace.namespace)
rescue Kubeclient::ResourceNotFoundError
# The resources have already been deleted, possibly on a previous attempt that timed out
- rescue Gitlab::UrlBlocker::BlockedUrlError
+ rescue Gitlab::HTTP_V2::UrlBlocker::BlockedUrlError
# User gave an invalid cluster from the start, or deleted the endpoint before this job ran
end
end
diff --git a/app/services/clusters/cleanup/service_account_service.rb b/app/services/clusters/cleanup/service_account_service.rb
index 0ce4bf9bb9c..0358a5412b3 100644
--- a/app/services/clusters/cleanup/service_account_service.rb
+++ b/app/services/clusters/cleanup/service_account_service.rb
@@ -22,7 +22,7 @@ module Clusters
)
rescue Kubeclient::ResourceNotFoundError
# The resources have already been deleted, possibly on a previous attempt that timed out
- rescue Gitlab::UrlBlocker::BlockedUrlError
+ rescue Gitlab::HTTP_V2::UrlBlocker::BlockedUrlError
# User gave an invalid cluster from the start, or deleted the endpoint before this job ran
rescue Kubeclient::HttpError => e
# unauthorized, forbidden: GitLab's access has been revoked
diff --git a/app/services/projects/import_service.rb b/app/services/projects/import_service.rb
index e22b728cea3..fde56d8429e 100644
--- a/app/services/projects/import_service.rb
+++ b/app/services/projects/import_service.rb
@@ -29,7 +29,7 @@ module Projects
after_execute_hook
success
- rescue Gitlab::UrlBlocker::BlockedUrlError, StandardError => e
+ rescue Gitlab::HTTP_V2::UrlBlocker::BlockedUrlError, StandardError => e
Gitlab::Import::ImportFailureService.track(
project_id: project.id,
error_source: self.class.name,
@@ -76,7 +76,7 @@ module Projects
if project.external_import? && !unknown_url?
begin
@resolved_address = get_resolved_address
- rescue Gitlab::UrlBlocker::BlockedUrlError => e
+ rescue Gitlab::HTTP_V2::UrlBlocker::BlockedUrlError => e
raise e, s_("ImportProjects|Blocked import URL: %{message}") % { message: e.message }
end
end
diff --git a/app/validators/addressable_url_validator.rb b/app/validators/addressable_url_validator.rb
index 6dcc089fa73..af7be326f51 100644
--- a/app/validators/addressable_url_validator.rb
+++ b/app/validators/addressable_url_validator.rb
@@ -84,7 +84,7 @@ class AddressableUrlValidator < ActiveModel::EachValidator
value = strip_value!(record, attribute, value)
Gitlab::UrlBlocker.validate!(value, **blocker_args)
- rescue Gitlab::UrlBlocker::BlockedUrlError => e
+ rescue Gitlab::HTTP_V2::UrlBlocker::BlockedUrlError => e
record.errors.add(attribute, options.fetch(:blocked_message) % { exception_message: e.message })
end
diff --git a/app/views/layouts/nav/_top_bar.html.haml b/app/views/layouts/nav/_top_bar.html.haml
index 73b253e18bd..59bfd8dd0dd 100644
--- a/app/views/layouts/nav/_top_bar.html.haml
+++ b/app/views/layouts/nav/_top_bar.html.haml
@@ -8,7 +8,7 @@
%div{ class: top_bar_class, data: { testid: 'top-bar' } }
.top-bar-container.gl-display-flex.gl-align-items-center.gl-gap-2{ :class => top_bar_container_class }
- if show_super_sidebar?
- = render Pajamas::ButtonComponent.new(icon: 'sidebar', category: :tertiary, button_options: { class: 'js-super-sidebar-toggle-expand super-sidebar-toggle gl-ml-n3', title: _('Expand sidebar'), aria: { controls: 'super-sidebar', expanded: 'false', label: _('Navigation sidebar') } })
+ = render Pajamas::ButtonComponent.new(icon: 'sidebar', category: :tertiary, button_options: { class: 'js-super-sidebar-toggle-expand super-sidebar-toggle gl-ml-n3', aria: { controls: 'super-sidebar', expanded: 'false', label: _('Primary navigation sidebar') } })
- elsif defined?(@left_sidebar)
= render Pajamas::ButtonComponent.new(icon: 'sidebar', category: :tertiary, button_options: { class: 'toggle-mobile-nav gl-ml-n3', data: { testid: 'toggle_mobile_nav_button' }, aria: { label: _('Open sidebar') } })
= render "layouts/nav/breadcrumbs/breadcrumbs"
diff --git a/app/workers/integrations/irker_worker.rb b/app/workers/integrations/irker_worker.rb
index 3152d68b372..4c1f0df0fc7 100644
--- a/app/workers/integrations/irker_worker.rb
+++ b/app/workers/integrations/irker_worker.rb
@@ -58,7 +58,7 @@ module Integrations
allow_local_network: allow_local_requests?,
schemes: ['irc'])
@socket = TCPSocket.new ip_address, irker_port
- rescue Errno::ECONNREFUSED, Gitlab::UrlBlocker::BlockedUrlError => e
+ rescue Errno::ECONNREFUSED, Gitlab::HTTP_V2::UrlBlocker::BlockedUrlError => e
logger.fatal "Can't connect to Irker daemon: #{e}"
return false
end