Commit 000fc22c authored by Ash McKenzie's avatar Ash McKenzie

Merge branch '234064-include-ancestors-iteration-annoyance' into 'master'

Iteration - do not default include ancestors when IID provided

See merge request gitlab-org/gitlab!38963
parents d438358d 368e9f58
...@@ -28,7 +28,7 @@ module Resolvers ...@@ -28,7 +28,7 @@ module Resolvers
authorize! authorize!
args[:include_ancestors] = true if args[:include_ancestors].nil? args[:include_ancestors] = true if args[:include_ancestors].nil? && args[:iid].nil?
iterations = IterationsFinder.new(context[:current_user], iterations_finder_params(args)).execute iterations = IterationsFinder.new(context[:current_user], iterations_finder_params(args)).execute
......
...@@ -45,7 +45,7 @@ RSpec.describe Resolvers::IterationsResolver do ...@@ -45,7 +45,7 @@ RSpec.describe Resolvers::IterationsResolver do
search = 'wow' search = 'wow'
id = 1 id = 1
iid = 2 iid = 2
params = { id: id, iid: iid, group_ids: Group.where(id: group.id).select(:id), state: 'closed', start_date: start_date, end_date: end_date, search_title: search } params = { id: id, iid: iid, group_ids: group.id, state: 'closed', start_date: start_date, end_date: end_date, search_title: search }
expect(IterationsFinder).to receive(:new).with(current_user, params).and_call_original expect(IterationsFinder).to receive(:new).with(current_user, params).and_call_original
...@@ -64,6 +64,14 @@ RSpec.describe Resolvers::IterationsResolver do ...@@ -64,6 +64,14 @@ RSpec.describe Resolvers::IterationsResolver do
resolve_group_iterations({}, subgroup) resolve_group_iterations({}, subgroup)
end end
it 'does not default to include_ancestors if IID is supplied' do
params = { id: nil, iid: 1, group_ids: subgroup.id, state: 'all', start_date: nil, end_date: nil, search_title: nil }
expect(IterationsFinder).to receive(:new).with(current_user, params).and_call_original
resolve_group_iterations({ iid: 1, include_ancestors: false }, subgroup)
end
it 'accepts include_ancestors false' do it 'accepts include_ancestors false' do
params = { id: nil, iid: nil, group_ids: subgroup.id, state: 'all', start_date: nil, end_date: nil, search_title: nil } params = { id: nil, iid: nil, group_ids: subgroup.id, state: 'all', start_date: nil, end_date: nil, search_title: nil }
......
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