Skip to content
Snippets Groups Projects
Commit d28523e2 authored by Andrew Smith's avatar Andrew Smith Committed by Matthias Käppler
Browse files

Correct validate epic_color_highlight FF in Epic mutations


The validation for the Epic `color` attribute was attempting to check
the feature flag status without passing in the group object to check the
feature flag against causing the attribute to always be removed unless
the feature flag was enabled globally.

The removal of the `color` attribute also happened at the wrong time.
The `color` attribute should be removed if the flag isn't enabled before
checking `args.empty?`.

Signed-off-by: default avatarAndrew Smith <espadav8@gmail.com>
parent 0c99f2e1
No related branches found
No related tags found
2 merge requests!91679Log Search API search timings to determine service levels,!91389Correct check of epic_color_highlight FF in Epic mutations
......@@ -58,13 +58,13 @@ module SharedEpicArguments
description: 'Color of the epic. Available only when feature flag `epic_color_highlight` is enabled. This flag is disabled by default, because the feature is experimental and is subject to change without notice.'
end
def validate_arguments!(args)
def validate_arguments!(args, group)
args.delete(:color) unless Feature.enabled?(:epic_color_highlight, group)
if args.empty?
raise Gitlab::Graphql::Errors::ArgumentError,
'The list of epic attributes is empty'
end
args.delete(:color) unless Feature.enabled?(:epic_color_highlight)
end
end
end
......@@ -18,9 +18,10 @@ class Create < BaseMutation
def resolve(args)
group_path = args.delete(:group_path)
validate_arguments!(args)
group = authorized_find!(group_path: group_path)
validate_arguments!(args, group)
epic = ::Epics::CreateService.new(group: group, current_user: current_user, params: args).execute
response_object = epic if epic.valid?
......
......@@ -18,9 +18,10 @@ def resolve(args)
group_path = args.delete(:group_path)
epic_iid = args.delete(:iid)
validate_arguments!(args)
epic = authorized_find!(group_path: group_path, iid: epic_iid)
validate_arguments!(args, epic.group)
epic = ::Epics::UpdateService.new(group: epic.group, current_user: current_user, params: args).execute(epic)
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment