Skip to content
代码片段 群组 项目
提交 d28523e2 编辑于 作者: Andrew Smith's avatar Andrew Smith 提交者: Matthias Käppler
浏览文件

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>
上级 0c99f2e1
No related branches found
No related tags found
无相关合并请求
...@@ -58,13 +58,13 @@ module SharedEpicArguments ...@@ -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.' 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 end
def validate_arguments!(args) def validate_arguments!(args, group)
args.delete(:color) unless Feature.enabled?(:epic_color_highlight, group)
if args.empty? if args.empty?
raise Gitlab::Graphql::Errors::ArgumentError, raise Gitlab::Graphql::Errors::ArgumentError,
'The list of epic attributes is empty' 'The list of epic attributes is empty'
end end
args.delete(:color) unless Feature.enabled?(:epic_color_highlight)
end end
end end
end end
...@@ -18,9 +18,10 @@ class Create < BaseMutation ...@@ -18,9 +18,10 @@ class Create < BaseMutation
def resolve(args) def resolve(args)
group_path = args.delete(:group_path) group_path = args.delete(:group_path)
validate_arguments!(args)
group = authorized_find!(group_path: group_path) group = authorized_find!(group_path: group_path)
validate_arguments!(args, group)
epic = ::Epics::CreateService.new(group: group, current_user: current_user, params: args).execute epic = ::Epics::CreateService.new(group: group, current_user: current_user, params: args).execute
response_object = epic if epic.valid? response_object = epic if epic.valid?
......
...@@ -18,9 +18,10 @@ def resolve(args) ...@@ -18,9 +18,10 @@ def resolve(args)
group_path = args.delete(:group_path) group_path = args.delete(:group_path)
epic_iid = args.delete(:iid) epic_iid = args.delete(:iid)
validate_arguments!(args)
epic = authorized_find!(group_path: group_path, iid: epic_iid) 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) epic = ::Epics::UpdateService.new(group: epic.group, current_user: current_user, params: args).execute(epic)
{ {
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册