diff options
author | Regis <boudinot.regis@yahoo.com> | 2017-01-04 10:55:25 -0700 |
---|---|---|
committer | Regis <boudinot.regis@yahoo.com> | 2017-01-04 10:55:25 -0700 |
commit | 1655824fa44c428b9570dc96688d27faef186024 (patch) | |
tree | 14bbb2ba241efbabef6def3b3415f9f1b6851d3a /lib/api | |
parent | cf039f58585e5238cd979ba70a5fd2d5c1eee650 (diff) | |
parent | ec4fe4432a2c4daa14c8e8f7c5d8567553062ebf (diff) | |
download | gitlab-ce-1655824fa44c428b9570dc96688d27faef186024.tar.gz |
Merge branch 'master' into auto-pipelines-vue
Diffstat (limited to 'lib/api')
-rw-r--r-- | lib/api/issues.rb | 29 | ||||
-rw-r--r-- | lib/api/project_hooks.rb | 2 | ||||
-rw-r--r-- | lib/api/users.rb | 2 |
3 files changed, 10 insertions, 23 deletions
diff --git a/lib/api/issues.rb b/lib/api/issues.rb index 91f65882f47..54b97402426 100644 --- a/lib/api/issues.rb +++ b/lib/api/issues.rb @@ -5,28 +5,18 @@ module API before { authenticate! } helpers do - def filter_issues_state(issues, state) - case state - when 'opened' then issues.opened - when 'closed' then issues.closed - else issues - end - end - + # TODO: Remove in 9.0 and switch to IssueFinder-based label filtering def filter_issues_labels(issues, labels) issues.includes(:labels).where('labels.title' => labels.split(',')) end - def filter_issues_milestone(issues, milestone) - issues.includes(:milestone).where('milestones.title' => milestone) - end - params :issues_params do optional :labels, type: String, desc: 'Comma-separated list of label names' optional :order_by, type: String, values: %w[created_at updated_at], default: 'created_at', desc: 'Return issues ordered by `created_at` or `updated_at` fields.' optional :sort, type: String, values: %w[asc desc], default: 'desc', desc: 'Return issues sorted in `asc` or `desc` order.' + optional :milestone, type: String, desc: 'Return issues for a specific milestone' use :pagination end @@ -50,8 +40,7 @@ module API use :issues_params end get do - issues = current_user.issues.inc_notes_with_associations - issues = filter_issues_state(issues, params[:state]) + issues = IssuesFinder.new(current_user, scope: 'all', author_id: current_user.id, state: params[:state]).execute.inc_notes_with_associations issues = filter_issues_labels(issues, params[:labels]) unless params[:labels].nil? issues = issues.reorder(params[:order_by] => params[:sort]) @@ -99,16 +88,14 @@ module API use :issues_params end get ":id/issues" do - issues = IssuesFinder.new(current_user, project_id: user_project.id).execute.inc_notes_with_associations - issues = filter_issues_state(issues, params[:state]) + issues = IssuesFinder.new(current_user, + project_id: user_project.id, + state: params[:state], + milestone_title: params[:milestone]).execute.inc_notes_with_associations issues = filter_issues_labels(issues, params[:labels]) unless params[:labels].nil? issues = filter_by_iid(issues, params[:iid]) unless params[:iid].nil? - - unless params[:milestone].nil? - issues = filter_issues_milestone(issues, params[:milestone]) - end - issues = issues.reorder(params[:order_by] => params[:sort]) + present paginate(issues), with: Entities::Issue, current_user: current_user, project: user_project end diff --git a/lib/api/project_hooks.rb b/lib/api/project_hooks.rb index dcc0fb7a911..cb679e6658a 100644 --- a/lib/api/project_hooks.rb +++ b/lib/api/project_hooks.rb @@ -15,7 +15,7 @@ module API optional :note_events, type: Boolean, desc: "Trigger hook on note(comment) events" optional :build_events, type: Boolean, desc: "Trigger hook on build events" optional :pipeline_events, type: Boolean, desc: "Trigger hook on pipeline events" - optional :wiki_events, type: Boolean, desc: "Trigger hook on wiki events" + optional :wiki_page_events, type: Boolean, desc: "Trigger hook on wiki events" optional :enable_ssl_verification, type: Boolean, desc: "Do SSL verification when triggering the hook" optional :token, type: String, desc: "Secret token to validate received payloads; this will not be returned in the response" end diff --git a/lib/api/users.rb b/lib/api/users.rb index 4c22287b5c6..de07fbf59fc 100644 --- a/lib/api/users.rb +++ b/lib/api/users.rb @@ -16,7 +16,7 @@ module API optional :website_url, type: String, desc: 'The website of the user' optional :organization, type: String, desc: 'The organization of the user' optional :projects_limit, type: Integer, desc: 'The number of projects a user can create' - optional :extern_uid, type: Integer, desc: 'The external authentication provider UID' + optional :extern_uid, type: String, desc: 'The external authentication provider UID' optional :provider, type: String, desc: 'The external provider' optional :bio, type: String, desc: 'The biography of the user' optional :location, type: String, desc: 'The location of the user' |