Commit f4d6ee7e authored by Scott Stern's avatar Scott Stern Committed by James Fargher

Fix graphql boards filtering by iterationId

parent 3140c76a
......@@ -34,8 +34,22 @@ module EE
def filter_by_iteration(filters)
iteration_wildcard_id = filters.delete(:iteration_wildcard_id)
# passing string is not failing the check...should be an array
iterations = filters[:iteration_id]
if iteration_wildcard_id
if iterations.present? && iteration_wildcard_id
raise ::Gitlab::Graphql::Errors::ArgumentError, 'Incompatible arguments: iterationId, iterationWildCardId.'
end
if iterations.present?
filters[:iteration_id] = iterations.map do |global_id|
# TODO: remove this line when the compatibility layer is removed
# See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883
parsed_id = ::Types::GlobalIDType[::Iteration].coerce_isolated_input(global_id)
parsed_id&.model_id
end
elsif iteration_wildcard_id
filters[:iteration_id] = iteration_wildcard_id
end
end
......
......@@ -107,6 +107,12 @@ RSpec.describe Resolvers::BoardListIssuesResolver do
expect(result).to contain_exactly(issue1, issue3)
end
it 'accepts iteration iteration id' do
result = resolve_board_list_issues({ filters: { iteration_id: [iteration.to_global_id] } })
expect(result).to contain_exactly(issue2)
end
context 'filterning by negated iteration' do
it 'accepts iteration wildcard id' do
result = resolve_board_list_issues({ filters: { not: { iteration_wildcard_id: 'CURRENT' } } })
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment