summaryrefslogtreecommitdiff
path: root/app/models/label.rb
diff options
context:
space:
mode:
authorJacopo <beschi.jacopo@gmail.com>2018-10-29 10:50:18 +0100
committerJacopo <beschi.jacopo@gmail.com>2018-11-23 16:11:52 +0100
commitc068ac67b3e40fdc039c80372306f9cc3360d594 (patch)
treed707871f8b7f5deb7f62d7630f317e94946eb1cc /app/models/label.rb
parentf0630090aaea98daef3582bc95efe3a43736a10f (diff)
downloadgitlab-ce-c068ac67b3e40fdc039c80372306f9cc3360d594.tar.gz
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/label.rb')
-rw-r--r--app/models/label.rb9
1 files changed, 2 insertions, 7 deletions
diff --git a/app/models/label.rb b/app/models/label.rb
index 165e4a8f3e5..5d2d1afd1d9 100644
--- a/app/models/label.rb
+++ b/app/models/label.rb
@@ -9,15 +9,10 @@ class Label < ActiveRecord::Base
include Sortable
include FromUnion
- # Represents a "No Label" state used for filtering Issues and Merge
- # Requests that have no label assigned.
- LabelStruct = Struct.new(:title, :name)
- None = LabelStruct.new('No Label', 'No Label')
- Any = LabelStruct.new('Any Label', '')
-
cache_markdown_field :description, pipeline: :single_line
- DEFAULT_COLOR = '#428BCA'.freeze
+ DEFAULT_COLOR = '#428BCA'
+ NONE = 'no label'
default_value_for :color, DEFAULT_COLOR