Commit 452afad1 authored by Heinrich Lee Yu's avatar Heinrich Lee Yu

Return ancestor group milestones for JSON requests

JSON requests are made for populating dropdowns and filters.
These should include ancestor milestones because ancestor
milestones can be assigned to the group's issues
parent 4ac2a641
......@@ -119,7 +119,9 @@ class Groups::MilestonesController < Groups::ApplicationController
end
def search_params
params.permit(:state, :search_title).merge(group_ids: group.id)
groups = request.format.json? ? group.self_and_ancestors.select(:id) : group.id
params.permit(:state, :search_title).merge(group_ids: groups)
end
end
......
---
title: Fix group issue list and group issue board filters not showing ancestor group
milestones
merge_request: 23038
author:
type: fixed
......@@ -148,6 +148,19 @@ describe Groups::MilestonesController do
expect(response).to have_gitlab_http_status(200)
expect(response.content_type).to eq 'application/json'
end
context 'for a subgroup' do
let(:subgroup) { create(:group, parent: group) }
it 'includes ancestor group milestones' do
get :index, params: { group_id: subgroup.to_param }, format: :json
milestones = json_response
expect(milestones.count).to eq(1)
expect(milestones.first['title']).to eq('group milestone')
end
end
end
context 'external authorization' do
......
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