diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-10-19 15:57:54 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-10-19 15:57:54 +0300 |
commit | 419c53ec62de6e97a517abd5fdd4cbde3a942a34 (patch) | |
tree | 1f43a548b46bca8a5fb8fe0c31cef1883d49c5b6 /lib/gitlab/graphql | |
parent | 1da20d9135b3ad9e75e65b028bffc921aaf8deb7 (diff) |
Add latest changes from gitlab-org/gitlab@16-5-stable-eev16.5.0-rc42
Diffstat (limited to 'lib/gitlab/graphql')
-rw-r--r-- | lib/gitlab/graphql/authorize/connection_filter_extension.rb | 7 | ||||
-rw-r--r-- | lib/gitlab/graphql/deprecations.rb | 15 | ||||
-rw-r--r-- | lib/gitlab/graphql/deprecations/deprecation.rb | 6 | ||||
-rw-r--r-- | lib/gitlab/graphql/pagination/active_record_array_connection.rb | 1 | ||||
-rw-r--r-- | lib/gitlab/graphql/queries.rb | 16 |
5 files changed, 31 insertions, 14 deletions
diff --git a/lib/gitlab/graphql/authorize/connection_filter_extension.rb b/lib/gitlab/graphql/authorize/connection_filter_extension.rb index 889c024ab5e..9b6398fc498 100644 --- a/lib/gitlab/graphql/authorize/connection_filter_extension.rb +++ b/lib/gitlab/graphql/authorize/connection_filter_extension.rb @@ -46,12 +46,15 @@ module Gitlab end def after_resolve(value:, context:, **rest) - return value if value.is_a?(GraphQL::Execution::Execute::Skip) + return value if value.is_a?(GraphQL::Execution::Skip) if @field.connection? redact_connection(value, context) elsif @field.type.list? - redact_list(value.to_a, context) unless value.nil? + unless value.nil? + value = value.to_a + redact_list(value, context) + end end value diff --git a/lib/gitlab/graphql/deprecations.rb b/lib/gitlab/graphql/deprecations.rb index 221b19bf8a3..61a49bd7473 100644 --- a/lib/gitlab/graphql/deprecations.rb +++ b/lib/gitlab/graphql/deprecations.rb @@ -11,6 +11,14 @@ module Gitlab attr_accessor :deprecation end + def initialize(*args, **kwargs, &block) + init_gitlab_deprecation(kwargs) + + super + + update_deprecation_description + end + def visible?(ctx) super && ctx[:remove_deprecated] == true ? deprecation.nil? : true end @@ -37,7 +45,12 @@ module Gitlab end kwargs[:deprecation_reason] = deprecation.deprecation_reason - kwargs[:description] = deprecation.edit_description(kwargs[:description]) + end + + def update_deprecation_description + return if deprecation.nil? + + description(deprecation.edit_description(description)) end end end diff --git a/lib/gitlab/graphql/deprecations/deprecation.rb b/lib/gitlab/graphql/deprecations/deprecation.rb index 0cf555b0e34..6821c7b0ab9 100644 --- a/lib/gitlab/graphql/deprecations/deprecation.rb +++ b/lib/gitlab/graphql/deprecations/deprecation.rb @@ -74,10 +74,10 @@ module Gitlab end def edit_description(original_description) - @original_description = original_description - return unless original_description + @original_description = original_description&.strip + return unless @original_description - original_description + description_suffix + @original_description + description_suffix end def original_description diff --git a/lib/gitlab/graphql/pagination/active_record_array_connection.rb b/lib/gitlab/graphql/pagination/active_record_array_connection.rb index 9e40f79b2fd..ce16693cf89 100644 --- a/lib/gitlab/graphql/pagination/active_record_array_connection.rb +++ b/lib/gitlab/graphql/pagination/active_record_array_connection.rb @@ -59,6 +59,7 @@ module Gitlab def dup self.class.new( items.dup, + context: context, first: first, after: after, max_page_size: max_page_size, diff --git a/lib/gitlab/graphql/queries.rb b/lib/gitlab/graphql/queries.rb index 9cdc84ffaa3..fc569bdc5dc 100644 --- a/lib/gitlab/graphql/queries.rb +++ b/lib/gitlab/graphql/queries.rb @@ -5,14 +5,14 @@ require 'find' module Gitlab module Graphql module Queries - IMPORT_RE = /^#\s*import "(?<path>[^"]+)"$/m.freeze - EE_ELSE_CE = /^ee_else_ce/.freeze - HOME_RE = /^~/.freeze - HOME_EE = %r{^ee/}.freeze - DOTS_RE = %r{^(\.\./)+}.freeze - DOT_RE = %r{^\./}.freeze - IMPLICIT_ROOT = %r{^app/}.freeze - CONN_DIRECTIVE = /@connection\(key: "\w+"\)/.freeze + IMPORT_RE = /^#\s*import "(?<path>[^"]+)"$/m + EE_ELSE_CE = /^ee_else_ce/ + HOME_RE = /^~/ + HOME_EE = %r{^ee/} + DOTS_RE = %r{^(\.\./)+} + DOT_RE = %r{^\./} + IMPLICIT_ROOT = %r{^app/} + CONN_DIRECTIVE = /@connection\(key: "\w+"\)/ class WrappedError delegate :message, to: :@error |