summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/api/issues.rb14
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