2020-02-12 19:08:46 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module API
|
|
|
|
module Entities
|
|
|
|
class Label < Entities::LabelBasic
|
|
|
|
with_options if: lambda { |_, options| options[:with_counts] } do
|
|
|
|
expose :open_issues_count do |label, options|
|
|
|
|
label.open_issues_count(options[:current_user])
|
|
|
|
end
|
|
|
|
|
|
|
|
expose :closed_issues_count do |label, options|
|
|
|
|
label.closed_issues_count(options[:current_user])
|
|
|
|
end
|
|
|
|
|
|
|
|
expose :open_merge_requests_count do |label, options|
|
|
|
|
label.open_merge_requests_count(options[:current_user])
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
expose :subscribed do |label, options|
|
2021-07-12 02:09:55 -04:00
|
|
|
label.subscribed?(options[:current_user]) || (
|
|
|
|
options[:parent].is_a?(::Project) && label.subscribed?(options[:current_user], options[:parent])
|
|
|
|
)
|
2020-02-12 19:08:46 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|