Class: MergeRequestsFinder
- Inherits:
-
IssuableFinder
- Object
- IssuableFinder
- MergeRequestsFinder
- Extended by:
- Gitlab::Utils::Override
- Includes:
- MergeUserFilter, MergedAtFilter
- Defined in:
- app/finders/merge_requests_finder.rb,
app/finders/merge_requests_finder/params.rb
Overview
Finders::MergeRequest class
Used to filter MergeRequests collections by set of params
Arguments:
current_user - which user use
params:
scope: 'created_by_me' or 'assigned_to_me' or 'all'
state: 'open', 'closed', 'merged', 'locked', or 'all'
group_id: integer
project_id: integer
milestone_title: string
release_tag: string
author_id: integer
author_username: string
assignee_id: integer
search: string
in: 'title', 'description', or a string joining them with comma
label_name: string
sort: string
non_archived: boolean
merged_without_event_source: boolean
my_reaction_emoji: string
source_branch: string
target_branch: string
created_after: datetime
created_before: datetime
updated_after: datetime
updated_before: datetime
Defined Under Namespace
Classes: Params
Constant Summary
Constants inherited from IssuableFinder
IssuableFinder::FULL_TEXT_SEARCH_TERM_PATTERN, IssuableFinder::FULL_TEXT_SEARCH_TERM_REGEX, IssuableFinder::NEGATABLE_PARAMS_HELPER_KEYS
Instance Attribute Summary
Attributes inherited from IssuableFinder
#current_user, #original_params, #params
Attributes included from FinderWithCrossProjectAccess
#should_skip_cross_project_check
Class Method Summary collapse
Instance Method Summary collapse
- #filter_items(_items) ⇒ Object
- #filter_negated_items(items) ⇒ Object
- #klass ⇒ Object
- #params_class ⇒ Object
Methods included from Gitlab::Utils::Override
extended, extensions, included, method_added, override, prepended, queue_verification, verify!
Methods inherited from IssuableFinder
#count_by_state, #execute, #initialize, negatable_array_params, negatable_params, negatable_scalar_params, #parent_param, #parent_param=, #row_count, #search, #should_filter_negated_args?, #use_cte_for_search?, valid_params
Methods included from UpdatedAtFilter
Methods included from CreatedAtFilter
Methods included from FinderMethods
Methods included from FinderWithCrossProjectAccess
#can_read_cross_project?, #can_read_project?, #execute, #find, #find_by, #find_by!, #skip_cross_project_check
Constructor Details
This class inherits a constructor from IssuableFinder
Class Method Details
.array_params ⇒ Object
60 61 62 |
# File 'app/finders/merge_requests_finder.rb', line 60 def self.array_params @array_params ||= super.merge(approved_by_usernames: []) end |
.scalar_params ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'app/finders/merge_requests_finder.rb', line 39 def self.scalar_params @scalar_params ||= super + [ :approved, :approved_by_ids, :deployed_after, :deployed_before, :draft, :environment, :merge_user_id, :merge_user_username, :merged_after, :merged_before, :reviewer_id, :reviewer_username, :review_state, :source_branch, :target_branch, :wip ] end |
Instance Method Details
#filter_items(_items) ⇒ Object
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'app/finders/merge_requests_finder.rb', line 72 def filter_items(_items) items = by_commit(super) items = by_source_branch(items) items = by_draft(items) items = by_target_branch(items) items = by_merge_user(items) items = by_merged_at(items) items = by_approvals(items) items = by_deployments(items) items = by_reviewer(items) items = by_review_state(items) items = by_source_project_id(items) items = by_resource_event_state(items) items = by_assignee_or_reviewer(items) by_approved(items) end |
#filter_negated_items(items) ⇒ Object
90 91 92 93 94 95 96 |
# File 'app/finders/merge_requests_finder.rb', line 90 def filter_negated_items(items) items = super(items) items = by_negated_reviewer(items) items = by_negated_approved_by(items) items = by_negated_target_branch(items) by_negated_source_branch(items) end |
#klass ⇒ Object
64 65 66 |
# File 'app/finders/merge_requests_finder.rb', line 64 def klass MergeRequest end |
#params_class ⇒ Object
68 69 70 |
# File 'app/finders/merge_requests_finder.rb', line 68 def params_class MergeRequestsFinder.const_get(:Params, false) # rubocop: disable CodeReuse/Finder end |