Commit 5d773e4c authored by Bob Van Landuyt's avatar Bob Van Landuyt

Hide the milestone in the API when the feature is not available

parent 286b8ee6
......@@ -619,7 +619,8 @@ module API
expose :id
expose :name
expose :project, using: Entities::BasicProjectDetails
expose :milestone
expose :milestone,
if: -> (board, _) { board.project.feature_available?(:issue_board_milestone) }
expose :lists, using: Entities::List do |board|
board.lists.destroyable
end
......
......@@ -57,6 +57,24 @@ describe API::Boards do
expect(response).to match_response_schema('public_api/v4/boards')
end
end
context 'with the issue_board_milestone-feature available' do
it 'returns the milestone when the `issue_board_milestone`-feature is enabled' do
stub_licensed_features(issue_board_milestone: true)
get api(base_url, user)
expect(json_response.first["milestone"]).not_to be_nil
end
it 'hides the milestone when the `issue_board_milestone`-feature is disabled' do
stub_licensed_features(issue_board_milestone: false)
get api(base_url, user)
expect(json_response.first["milestone"]).to be_nil
end
end
end
describe "GET /projects/:id/boards/:board_id/lists" 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