Revert "Merge branch '50559-add-milestone-progress-to-api' into 'master'"

This reverts merge request !25173
This commit is contained in:
Stan Hu 2019-02-14 05:06:38 +00:00
parent c6016ac8a8
commit 22f63b7b54
7 changed files with 4 additions and 20 deletions

View file

@ -1,5 +0,0 @@
---
title: 'API: Expose milestone progress'
merge_request: 25173
author: Robert Schilling
type: added

View file

@ -42,7 +42,6 @@ Example Response:
"due_date": "2013-11-29",
"start_date": "2013-11-10",
"state": "active",
"percentage_complete" : 66,
"updated_at": "2013-10-02T09:24:18Z",
"created_at": "2013-10-02T09:24:18Z"
}

View file

@ -39,7 +39,6 @@ Example Response:
"due_date": "2013-11-29",
"start_date": "2013-11-10",
"state": "active",
"percentage_complete" : 66,
"updated_at": "2013-10-02T09:24:18Z",
"created_at": "2013-10-02T09:24:18Z"
}

View file

@ -502,9 +502,6 @@ module API
expose :state, :created_at, :updated_at
expose :due_date
expose :start_date
expose :percentage_complete do |milestone, options|
milestone.percent_complete(options[:current_user])
end
expose :web_url do |milestone, _options|
Gitlab::UrlBuilder.build(milestone)

View file

@ -35,19 +35,19 @@ module API
milestones = filter_by_iid(milestones, params[:iids]) if params[:iids].present?
milestones = filter_by_search(milestones, params[:search]) if params[:search]
present paginate(milestones), with: Entities::Milestone, current_user: current_user
present paginate(milestones), with: Entities::Milestone
end
def get_milestone_for(parent)
milestone = parent.milestones.find(params[:milestone_id])
present milestone, with: Entities::Milestone, current_user: current_user
present milestone, with: Entities::Milestone
end
def create_milestone_for(parent)
milestone = ::Milestones::CreateService.new(parent, current_user, declared_params).execute
if milestone.valid?
present milestone, with: Entities::Milestone, current_user: current_user
present milestone, with: Entities::Milestone
else
render_api_error!("Failed to create milestone #{milestone.errors.messages}", 400)
end
@ -60,7 +60,7 @@ module API
milestone = ::Milestones::UpdateService.new(parent, current_user, milestone_params).execute(milestone)
if milestone.valid?
present milestone, with: Entities::Milestone, current_user: current_user
present milestone, with: Entities::Milestone
else
render_api_error!("Failed to update milestone #{milestone.errors.messages}", 400)
end

View file

@ -8,7 +8,6 @@
"title": { "type": "string" },
"description": { "type": ["string", "null"] },
"state": { "type": "string" },
"percentage_complete": { "type": "integer" },
"created_at": { "type": "date" },
"updated_at": { "type": "date" },
"start_date": { "type": "date" },

View file

@ -8,17 +8,12 @@ shared_examples_for 'group and project milestones' do |route_definition|
describe "GET #{route_definition}" do
it 'returns milestones list' do
create(:issue, project: project, milestone: milestone)
create(:closed_issue, project: project, milestone: milestone)
create(:closed_issue, project: project, milestone: milestone)
get api(route, user)
expect(response).to have_gitlab_http_status(200)
expect(response).to include_pagination_headers
expect(json_response).to be_an Array
expect(json_response.first['title']).to eq(milestone.title)
expect(json_response.first['percentage_complete']).to eq(66)
end
it 'returns a 401 error if user not authenticated' do