diff options
author | Mark Fletcher <mark@gitlab.com> | 2017-02-28 15:23:40 +0300 |
---|---|---|
committer | Mark Fletcher <mark@gitlab.com> | 2017-03-02 07:37:57 +0300 |
commit | 61baf3528d2f39ffc8f7aa07eddf3df0cec3508b (patch) | |
tree | d3830021e7dbe0b16071776e39578ffff2c3be1d /lib/api/milestones.rb | |
parent | 7733f285aca97d444382a59eda0ea3e303539c26 (diff) |
Enable filtering milestones by search criteria in the API
- Also remove a redundant test
Diffstat (limited to 'lib/api/milestones.rb')
-rw-r--r-- | lib/api/milestones.rb | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/api/milestones.rb b/lib/api/milestones.rb index 0b4ed76b35c..44bdaea7fa4 100644 --- a/lib/api/milestones.rb +++ b/lib/api/milestones.rb @@ -31,6 +31,7 @@ module API optional :state, type: String, values: %w[active closed all], default: 'all', desc: 'Return "active", "closed", or "all" milestones' optional :iid, type: Array[Integer], desc: 'The IID of the milestone' + optional :search, type: String, desc: 'The search criteria for the title or description of the milestone' use :pagination end get ":id/milestones" do @@ -39,6 +40,7 @@ module API milestones = user_project.milestones milestones = filter_milestones_state(milestones, params[:state]) milestones = filter_by_iid(milestones, params[:iid]) if params[:iid].present? + milestones = filter_by_search(milestones, params[:search]) if params[:search] present paginate(milestones), with: Entities::Milestone end |