Class: Namespaces::ProjectsFinder
- Inherits:
-
Object
- Object
- Namespaces::ProjectsFinder
- Defined in:
- app/finders/namespaces/projects_finder.rb
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(namespace: nil, current_user: nil, params: {}) ⇒ ProjectsFinder
constructor
A new instance of ProjectsFinder.
Constructor Details
#initialize(namespace: nil, current_user: nil, params: {}) ⇒ ProjectsFinder
Returns a new instance of ProjectsFinder.
25 26 27 28 29 |
# File 'app/finders/namespaces/projects_finder.rb', line 25 def initialize(namespace: nil, current_user: nil, params: {}) @namespace = namespace @current_user = current_user @params = params end |
Instance Method Details
#execute ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'app/finders/namespaces/projects_finder.rb', line 31 def execute return Project.none if namespace.nil? container = if params[:include_sibling_projects] && namespace.is_a?(ProjectNamespace) namespace.group else namespace end collection = if params[:include_subgroups].present? container.all_projects.with_route else container.projects.with_route end collection = collection.not_aimed_for_deletion if params[:not_aimed_for_deletion].present? collection = filter_projects(collection) sort(collection) end |