Class: IssuesFinder
- Inherits:
-
IssuableFinder
- Object
- IssuableFinder
- IssuesFinder
- Defined in:
- app/finders/issues_finder.rb,
app/finders/issues_finder/params.rb
Overview
Finders::Issues class
Used to filter Issues collections by set of params
Arguments:
current_user - which user use
params:
scope: 'created_by_me' or 'assigned_to_me' or 'all'
state: 'opened' or 'closed' or 'all'
group_id: integer
project_id: integer
milestone_title: string
assignee_id: integer
search: string
in: 'title', 'description', or a string joining them with comma
label_name: string
sort: string
my_reaction_emoji: string
public_only: boolean
due_date: date or '0', '', 'overdue', 'week', or 'month'
created_after: datetime
created_before: datetime
updated_after: datetime
updated_before: datetime
confidential: boolean
issue_type: array of strings (one of Issue.issue_types)
Defined Under Namespace
Classes: Params
Constant Summary collapse
Constants inherited from IssuableFinder
IssuableFinder::NEGATABLE_PARAMS_HELPER_KEYS
Instance Attribute Summary
Attributes inherited from IssuableFinder
Class Method Summary collapse
Instance Method Summary collapse
-
#klass ⇒ Object
rubocop: disable CodeReuse/ActiveRecord.
-
#params_class ⇒ Object
rubocop: enable CodeReuse/ActiveRecord.
-
#with_confidentiality_access_check ⇒ Object
rubocop: disable CodeReuse/ActiveRecord.
Methods inherited from IssuableFinder
array_params, #count_by_state, #execute, #filter_negated_items, #initialize, negatable_array_params, negatable_params, negatable_scalar_params, #row_count, #search, #use_cte_for_search?, valid_params
Methods included from Gitlab::Utils::StrongMemoize
#clear_memoization, #strong_memoize, #strong_memoized?
Methods included from CreatedAtFilter
Methods included from FinderMethods
Constructor Details
This class inherits a constructor from IssuableFinder
Class Method Details
.scalar_params ⇒ Object
33 34 35 |
# File 'app/finders/issues_finder.rb', line 33 def self.scalar_params @scalar_params ||= super + [:due_date] end |
Instance Method Details
#klass ⇒ Object
rubocop: disable CodeReuse/ActiveRecord
38 39 40 |
# File 'app/finders/issues_finder.rb', line 38 def klass Issue.includes(:author) end |
#params_class ⇒ Object
rubocop: enable CodeReuse/ActiveRecord
43 44 45 |
# File 'app/finders/issues_finder.rb', line 43 def params_class self.class.const_get(:Params, false) end |
#with_confidentiality_access_check ⇒ Object
rubocop: disable CodeReuse/ActiveRecord
48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'app/finders/issues_finder.rb', line 48 def with_confidentiality_access_check return Issue.all if params.user_can_see_all_confidential_issues? return Issue.where('issues.confidential IS NOT TRUE') if params.user_cannot_see_confidential_issues? Issue.where(' issues.confidential IS NOT TRUE OR (issues.confidential = TRUE AND (issues.author_id = :user_id OR EXISTS (SELECT TRUE FROM issue_assignees WHERE user_id = :user_id AND issue_id = issues.id) OR EXISTS (:authorizations)))', user_id: current_user.id, authorizations: current_user.(min_access_level: CONFIDENTIAL_ACCESS_LEVEL, related_project_column: "issues.project_id")) end |