diff options
author | Jacopo <beschi.jacopo@gmail.com> | 2018-10-03 14:00:03 +0300 |
---|---|---|
committer | Jacopo <beschi.jacopo@gmail.com> | 2018-10-03 15:19:08 +0300 |
commit | a1c3d40739ed133e1ca1cd9191628acf938809cf (patch) | |
tree | c5db7647bd3e842d1ef968df0cff14edf6d23fae /app/models/concerns/issuable.rb | |
parent | bf37ff071fca1b61681e42522ffb6a6dcf5c0e8d (diff) |
Allows to filter issues by `Any milestone` in the API
In GET `api/v4/projects/:id/issues` the user can filter issues
that have an assigned milestone through the parameter
`milestone=Any+Milestone`.
Diffstat (limited to 'app/models/concerns/issuable.rb')
-rw-r--r-- | app/models/concerns/issuable.rb | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/app/models/concerns/issuable.rb b/app/models/concerns/issuable.rb index 5f65fceb7af..2aa52bbaeea 100644 --- a/app/models/concerns/issuable.rb +++ b/app/models/concerns/issuable.rb @@ -76,6 +76,7 @@ module Issuable scope :recent, -> { reorder(id: :desc) } scope :of_projects, ->(ids) { where(project_id: ids) } scope :of_milestones, ->(ids) { where(milestone_id: ids) } + scope :any_milestone, -> { where('milestone_id IS NOT NULL') } scope :with_milestone, ->(title) { left_joins_milestones.where(milestones: { title: title }) } scope :opened, -> { with_state(:opened) } scope :only_opened, -> { with_state(:opened) } |