diff options
author | Panagiotis Atmatzidis <atma@convalesco.org> | 2016-10-12 15:08:57 +0300 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2017-01-13 01:51:06 +0300 |
commit | 5c253116ae57c9db567394f544a40997de115f82 (patch) | |
tree | 9c3af7f8dc76aee03d3f01cd01c4c0a0fd02beff /lib/api/issues.rb | |
parent | e75b1f11057829964dd9c3aac3b0a0deb964707e (diff) |
Adding 'IssueFinder' for 'projects' API endpoint
Current filtering for "/projects/:id/issues" endpoint
returns no results for "No Milestone" query.
This PR introduces fix by copying filtering from "/groups/:id/issues"
which works as expected.
Diffstat (limited to 'lib/api/issues.rb')
-rw-r--r-- | lib/api/issues.rb | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/api/issues.rb b/lib/api/issues.rb index 54b97402426..dc55bb10636 100644 --- a/lib/api/issues.rb +++ b/lib/api/issues.rb @@ -88,12 +88,14 @@ module API use :issues_params end get ":id/issues" do - 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? + project = find_project(params[:id]) + params[:state] ||= 'opened' + params[:project_id] = project.id + params[:milestone_title] = params.delete(:milestone) + params[:label_name] = params.delete(:labels) + + issues = IssuesFinder.new(current_user, params).execute + issues = issues.reorder(params[:order_by] => params[:sort]) present paginate(issues), with: Entities::Issue, current_user: current_user, project: user_project |