diff options
author | Jacopo <beschi.jacopo@gmail.com> | 2018-10-29 12:50:18 +0300 |
---|---|---|
committer | Jacopo <beschi.jacopo@gmail.com> | 2018-11-23 18:11:52 +0300 |
commit | c068ac67b3e40fdc039c80372306f9cc3360d594 (patch) | |
tree | d707871f8b7f5deb7f62d7630f317e94946eb1cc /app/models/concerns/issuable.rb | |
parent | f0630090aaea98daef3582bc95efe3a43736a10f (diff) |
Filter by `None`/`Any` for labels in issues/mrs API
By using the parameters `?labels=None|Any` the user can filter
issues/mrs from the API that has `none/any` label.
Affected endpoints are:
- /api/issues
- /api/projects/:id/issues
- /api/groups/:id/issues
- /api/merge_requests
- /api/projects/:id/merge_requests
- /api/groups/:id/merge_requests
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 69c5affe142..5080fe03cc8 100644 --- a/app/models/concerns/issuable.rb +++ b/app/models/concerns/issuable.rb @@ -90,6 +90,7 @@ module Issuable scope :order_milestone_due_asc, -> { left_joins_milestones.reorder('milestones.due_date IS NULL, milestones.id IS NULL, milestones.due_date ASC') } scope :without_label, -> { joins("LEFT OUTER JOIN label_links ON label_links.target_type = '#{name}' AND label_links.target_id = #{table_name}.id").where(label_links: { id: nil }) } + scope :any_label, -> { joins(:label_links).group(:id) } scope :join_project, -> { joins(:project) } scope :inc_notes_with_associations, -> { includes(notes: [:project, :author, :award_emoji]) } scope :references_project, -> { references(:project) } |