summaryrefslogtreecommitdiff
path: root/lib/api/helpers
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-02-18 09:45:46 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2022-02-18 09:45:46 +0000
commita7b3560714b4d9cc4ab32dffcd1f74a284b93580 (patch)
tree7452bd5c3545c2fa67a28aa013835fb4fa071baf /lib/api/helpers
parentee9173579ae56a3dbfe5afe9f9410c65bb327ca7 (diff)
downloadgitlab-ce-a7b3560714b4d9cc4ab32dffcd1f74a284b93580.tar.gz
Add latest changes from gitlab-org/gitlab@14-8-stable-eev14.8.0-rc42
Diffstat (limited to 'lib/api/helpers')
-rw-r--r--lib/api/helpers/container_registry_helpers.rb2
-rw-r--r--lib/api/helpers/integrations_helpers.rb8
-rw-r--r--lib/api/helpers/internal_helpers.rb3
-rw-r--r--lib/api/helpers/members_helpers.rb2
-rw-r--r--lib/api/helpers/merge_requests_helpers.rb20
-rw-r--r--lib/api/helpers/rate_limiter.rb2
6 files changed, 30 insertions, 7 deletions
diff --git a/lib/api/helpers/container_registry_helpers.rb b/lib/api/helpers/container_registry_helpers.rb
index 9c844e364eb..78daf2c8cb1 100644
--- a/lib/api/helpers/container_registry_helpers.rb
+++ b/lib/api/helpers/container_registry_helpers.rb
@@ -6,7 +6,7 @@ module API
extend ActiveSupport::Concern
included do
- rescue_from Faraday::Error, ContainerRegistry::Path::InvalidRegistryPathError do |e|
+ rescue_from Faraday::Error, ::ContainerRegistry::Path::InvalidRegistryPathError do |e|
service_unavailable!('We are having trouble connecting to the Container Registry. If this error persists, please review the troubleshooting documentation.')
end
end
diff --git a/lib/api/helpers/integrations_helpers.rb b/lib/api/helpers/integrations_helpers.rb
index 72b16a23dd6..86dedc12fca 100644
--- a/lib/api/helpers/integrations_helpers.rb
+++ b/lib/api/helpers/integrations_helpers.rb
@@ -346,7 +346,13 @@ module API
required: false,
name: :datadog_env,
type: String,
- desc: 'For self-managed deployments, set the env tag for all the data sent to Datadog. How do I use tags?'
+ desc: 'For self-managed deployments, set the env tag for all the data sent to Datadog'
+ },
+ {
+ required: false,
+ name: :datadog_tags,
+ type: String,
+ desc: 'Custom tags in Datadog. Specify one tag per line in the format: "key:value\nkey2:value2"'
}
],
'discord' => [
diff --git a/lib/api/helpers/internal_helpers.rb b/lib/api/helpers/internal_helpers.rb
index e03f029a6ef..46685df0989 100644
--- a/lib/api/helpers/internal_helpers.rb
+++ b/lib/api/helpers/internal_helpers.rb
@@ -124,7 +124,8 @@ module API
repository: repository.gitaly_repository.to_h,
address: Gitlab::GitalyClient.address(repository.shard),
token: Gitlab::GitalyClient.token(repository.shard),
- features: Feature::Gitaly.server_feature_flags(repository.project)
+ features: Feature::Gitaly.server_feature_flags(repository.project),
+ use_sidechannel: Feature.enabled?(:gitlab_shell_upload_pack_sidechannel, repository.project, default_enabled: :yaml)
}
end
end
diff --git a/lib/api/helpers/members_helpers.rb b/lib/api/helpers/members_helpers.rb
index 6c20993431d..f26ac1318b1 100644
--- a/lib/api/helpers/members_helpers.rb
+++ b/lib/api/helpers/members_helpers.rb
@@ -23,7 +23,7 @@ module API
def retrieve_members(source, params:, deep: false)
members = deep ? find_all_members(source) : source_members(source).connected_to_user
members = members.includes(:user)
- members = members.references(:user).merge(User.search(params[:query])) if params[:query].present?
+ members = members.references(:user).merge(User.search(params[:query], use_minimum_char_limit: false)) if params[:query].present?
members = members.where(user_id: params[:user_ids]) if params[:user_ids].present?
members
end
diff --git a/lib/api/helpers/merge_requests_helpers.rb b/lib/api/helpers/merge_requests_helpers.rb
index f8fe40f7135..00d9f49adf0 100644
--- a/lib/api/helpers/merge_requests_helpers.rb
+++ b/lib/api/helpers/merge_requests_helpers.rb
@@ -47,9 +47,9 @@ module API
desc: 'Return opened, closed, locked, merged, or all merge requests'
optional :order_by,
type: String,
- values: %w[created_at updated_at],
+ values: Helpers::MergeRequestsHelpers.sort_options,
default: 'created_at',
- desc: 'Return merge requests ordered by `created_at` or `updated_at` fields.'
+ desc: "Return merge requests ordered by #{Helpers::MergeRequestsHelpers.sort_options_help} fields."
optional :sort,
type: String,
values: %w[asc desc],
@@ -115,6 +115,22 @@ module API
render_validation_error!(merge_request)
end
+
+ def self.sort_options
+ %w[
+ created_at
+ label_priority
+ milestone_due
+ popularity
+ priority
+ title
+ updated_at
+ ]
+ end
+
+ def self.sort_options_help
+ sort_options.map {|y| "`#{y}`" }.to_sentence(last_word_connector: ' or ')
+ end
end
end
end
diff --git a/lib/api/helpers/rate_limiter.rb b/lib/api/helpers/rate_limiter.rb
index 0ad4f089907..03f3cd649b1 100644
--- a/lib/api/helpers/rate_limiter.rb
+++ b/lib/api/helpers/rate_limiter.rb
@@ -5,7 +5,7 @@ module API
# == RateLimiter
#
# Helper that checks if the rate limit for a given endpoint is throttled by calling the
- # Gitlab::ApplicationRateLimiter class. If the action is throttled for the current user, the request
+ # Gitlab::ApplicationRateLimiter module. If the action is throttled for the current user, the request
# will be logged and an error message will be rendered with a Too Many Requests response status.
# See app/controllers/concerns/check_rate_limit.rb for Rails controllers version
module RateLimiter