summaryrefslogtreecommitdiff
path: root/app/models/label.rb
diff options
context:
space:
mode:
authorJan Provaznik <jprovaznik@gitlab.com>2019-04-23 19:58:20 +0000
committerDouglas Barbosa Alexandre <dbalexandre@gmail.com>2019-04-23 19:58:20 +0000
commit8ce4b6093a2e64f21928dded6c58950f180d8c2a (patch)
treee3478cf58d2119fd2f84572d34acf0c507e75a5b /app/models/label.rb
parentbe15592a1c1551bb6136081ea995dca49e238c8f (diff)
downloadgitlab-ce-8ce4b6093a2e64f21928dded6c58950f180d8c2a.tar.gz
Move scoped_label into label presenter
When rendering a label we want to check 'scoped_label' feature availability on a project/group where label is being used. For this reason a label presenter is used in UI and information about context project/group is passed to this presenter.
Diffstat (limited to 'app/models/label.rb')
-rw-r--r--app/models/label.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/app/models/label.rb b/app/models/label.rb
index c7fff0d393e..e9085e8bd25 100644
--- a/app/models/label.rb
+++ b/app/models/label.rb
@@ -8,6 +8,7 @@ class Label < ApplicationRecord
include OptionallySearch
include Sortable
include FromUnion
+ include Presentable
cache_markdown_field :description, pipeline: :single_line
@@ -233,6 +234,10 @@ class Label < ApplicationRecord
attributes
end
+ def present(attributes)
+ super(attributes.merge(presenter_class: ::LabelPresenter))
+ end
+
private
def issues_count(user, params = {})