Class: ProjectsFinder
- Inherits:
-
UnionFinder
- Object
- UnionFinder
- ProjectsFinder
- Defined in:
- app/finders/projects_finder.rb
Overview
ProjectsFinder
Used to filter Projects by set of params
Arguments:
current_user - which user use
project_ids_relation: int[] - project ids to use
params:
trending: boolean
owned: boolean
non_public: boolean
starred: boolean
sort: string
visibility_level: int
tag: string[] - deprecated, use 'topic' instead
topic: string[]
topic_id: int
personal: boolean
search: string
search_namespaces: boolean
minimum_search_length: int
non_archived: boolean
archived: 'only' or boolean
min_access_level: integer
last_activity_after: datetime
last_activity_before: datetime
repository_storage: string
not_aimed_for_deletion: boolean
full_paths: string[]
organization: Scope the groups to the Organizations::Organization
language: int
language_name: string
Direct Known Subclasses
ForkProjectsFinder, GroupProjectsFinder, StarredProjectsFinder
Instance Attribute Summary collapse
-
#current_user ⇒ Object
readonly
Returns the value of attribute current_user.
-
#params ⇒ Object
Returns the value of attribute params.
-
#project_ids_relation ⇒ Object
readonly
Returns the value of attribute project_ids_relation.
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(params: {}, current_user: nil, project_ids_relation: nil) ⇒ ProjectsFinder
constructor
A new instance of ProjectsFinder.
Methods included from UpdatedAtFilter
Methods included from CustomAttributesFilter
Methods inherited from UnionFinder
Constructor Details
#initialize(params: {}, current_user: nil, project_ids_relation: nil) ⇒ ProjectsFinder
Returns a new instance of ProjectsFinder.
44 45 46 47 48 49 50 |
# File 'app/finders/projects_finder.rb', line 44 def initialize(params: {}, current_user: nil, project_ids_relation: nil) @params = params @current_user = current_user @project_ids_relation = project_ids_relation @params[:topic] ||= @params.delete(:tag) if @params[:tag].present? end |
Instance Attribute Details
#current_user ⇒ Object (readonly)
Returns the value of attribute current_user.
42 43 44 |
# File 'app/finders/projects_finder.rb', line 42 def current_user @current_user end |
#params ⇒ Object
Returns the value of attribute params.
41 42 43 |
# File 'app/finders/projects_finder.rb', line 41 def params @params end |
#project_ids_relation ⇒ Object (readonly)
Returns the value of attribute project_ids_relation.
42 43 44 |
# File 'app/finders/projects_finder.rb', line 42 def project_ids_relation @project_ids_relation end |
Instance Method Details
#execute ⇒ Object
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'app/finders/projects_finder.rb', line 52 def execute user = params.delete(:user) collection = if user PersonalProjectsFinder.new(user, finder_params).execute(current_user) # rubocop: disable CodeReuse/Finder else init_collection end if Feature.enabled?(:hide_projects_of_banned_users) collection = without_created_and_owned_by_banned_user(collection) end use_cte = params.delete(:use_cte) collection = Project.wrap_with_cte(collection) if use_cte collection = filter_projects(collection) sort(collection).allow_cross_joins_across_databases(url: "https://gitlab.com/gitlab-org/gitlab/-/issues/427628") end |