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
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-08-18 11:17:02 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-08-18 11:17:02 +0300
commitb39512ed755239198a9c294b6a45e65c05900235 (patch)
treed234a3efade1de67c46b9e5a38ce813627726aa7 /lib/gitlab/graphql/deprecation.rb
parentd31474cf3b17ece37939d20082b07f6657cc79a9 (diff)
Add latest changes from gitlab-org/gitlab@15-3-stable-eev15.3.0-rc42
Diffstat (limited to 'lib/gitlab/graphql/deprecation.rb')
-rw-r--r--lib/gitlab/graphql/deprecation.rb20
1 files changed, 17 insertions, 3 deletions
diff --git a/lib/gitlab/graphql/deprecation.rb b/lib/gitlab/graphql/deprecation.rb
index d30751fe46e..9b17962f9ec 100644
--- a/lib/gitlab/graphql/deprecation.rb
+++ b/lib/gitlab/graphql/deprecation.rb
@@ -21,8 +21,18 @@ module Gitlab
validate :milestone_is_string
validate :reason_known_or_string
- def self.parse(options)
- new(**options) if options
+ def self.parse(alpha: nil, deprecated: nil)
+ options = alpha || deprecated
+ return unless options
+
+ if alpha
+ raise ArgumentError, '`alpha` and `deprecated` arguments cannot be passed at the same time' \
+ if deprecated
+
+ options[:reason] = :alpha
+ end
+
+ new(**options)
end
def initialize(reason: nil, milestone: nil, replacement: nil)
@@ -84,6 +94,10 @@ module Gitlab
].compact.join(' ')
end
+ def alpha?
+ reason == REASON_ALPHA
+ end
+
private
attr_reader :reason, :milestone, :replacement
@@ -117,7 +131,7 @@ module Gitlab
# Retruns 'Introduced in <milestone>' for :alpha deprecations.
# Formatted to markdown or plain format.
def changed_in_milestone(format: :plain)
- verb = if reason == REASON_ALPHA
+ verb = if alpha?
'Introduced'
else
'Deprecated'