Class: LabelsFinder
- Inherits:
-
UnionFinder
- Object
- UnionFinder
- LabelsFinder
- Includes:
- FinderMethods, FinderWithCrossProjectAccess, FinderWithGroupHierarchy, Gitlab::Utils::StrongMemoize
- Defined in:
- app/finders/labels_finder.rb
Instance Attribute Summary
Attributes included from FinderWithCrossProjectAccess
#should_skip_cross_project_check
Instance Method Summary collapse
- #execute(skip_authorization: false) ⇒ Object
-
#initialize(current_user, params = {}) ⇒ LabelsFinder
constructor
A new instance of LabelsFinder.
Methods included from FinderMethods
Methods included from FinderWithCrossProjectAccess
#can_read_cross_project?, #can_read_project?, #find, #find_by, #find_by!, #skip_cross_project_check
Methods included from Gitlab::Utils::Override
#extended, extensions, #included, #method_added, #override, #prepended, #queue_verification, verify!
Methods inherited from UnionFinder
Constructor Details
#initialize(current_user, params = {}) ⇒ LabelsFinder
Returns a new instance of LabelsFinder.
11 12 13 14 15 16 17 18 19 |
# File 'app/finders/labels_finder.rb', line 11 def initialize(current_user, params = {}) @current_user = current_user @params = params # Preload container records (project, group) by default, in some cases we invoke # the LabelsPreloader on the loaded records to prevent all N+1 queries. # In that case we disable the default with_preloaded_container scope because it # interferes with the LabelsPreloader. @preload_parent_association = params.fetch(:preload_parent_association, true) end |
Instance Method Details
#execute(skip_authorization: false) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 |
# File 'app/finders/labels_finder.rb', line 21 def execute(skip_authorization: false) @skip_authorization = items = find_union(item_ids, Label) || Label.none items = with_title(items) items = by_subscription(items) items = by_search(items) items = by_locked_labels(items) items = items.with_preloaded_container if @preload_parent_association sort(items) end |