Commit 5c253116 authored by Panagiotis Atmatzidis's avatar Panagiotis Atmatzidis Committed by Rémy Coutable

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.
parent e75b1f11
...@@ -88,12 +88,14 @@ module API ...@@ -88,12 +88,14 @@ module API
use :issues_params use :issues_params
end end
get ":id/issues" do get ":id/issues" do
issues = IssuesFinder.new(current_user, project = find_project(params[:id])
project_id: user_project.id, params[:state] ||= 'opened'
state: params[:state], params[:project_id] = project.id
milestone_title: params[:milestone]).execute.inc_notes_with_associations params[:milestone_title] = params.delete(:milestone)
issues = filter_issues_labels(issues, params[:labels]) unless params[:labels].nil? params[:label_name] = params.delete(:labels)
issues = filter_by_iid(issues, params[:iid]) unless params[:iid].nil?
issues = IssuesFinder.new(current_user, params).execute
issues = issues.reorder(params[:order_by] => params[:sort]) issues = issues.reorder(params[:order_by] => params[:sort])
present paginate(issues), with: Entities::Issue, current_user: current_user, project: user_project present paginate(issues), with: Entities::Issue, current_user: current_user, project: user_project
......
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