Make organization related project archival features compatible with group archival
Prerequisite
Before you start, please check out the parent epic description to get the full context: Make project archival features compatible with ... (&19690)
Description
We ran a search for "archive" and "archival" in the codebase and pulled together the following relevant results for the grouporganizations domain. We'd need your help with:
- Review the search results and update the code to use our new ancestor-aware methods and scopes wherever needed
- Creating new services/workers wherever they're needed
- Note: Not all "archive" mentions are about project archival – feel free to skip anything that's not relevant!
Archive/Archival Occurrences
Groups & Projects
- 
ee/app/models/ee/namespace.rb 
- 
app/helpers/explore_helper.rb 
- 
app/services/projects/autocomplete_service.rb 
- 
app/models/project.rb 
- 
app/models/namespace.rb - 
has_many :non_archived_projects, -> { where.not(archived: true) }, class_name: 'Project' 
- 
delegate :archived, :archived= 
- 
scope :archived, -> { joins(:namespace_settings).where(namespace_settings: { archived: true }) } 
- 
scope :non_archived, -> { joins(:namespace_settings).where(namespace_settings: { archived: false }) } 
 
- 
- 
app/models/group.rb 
- 
app/models/namespaces/descendants.rb 
- 
app/models/namespaces/traversal/cached.rb 
- 
app/models/namespaces/traversal/recursive.rb 
- 
app/models/concerns/loaded_in_group_list.rb - 
def with_counts(archived: nil, active: nil) 
- 
projects_cte = projects_cte(archived, active) 
- 
subgroups_cte = subgroups_cte(archived, active) 
- 
def with_selects_for_list(archived: nil, active: nil) 
- 
.with_counts(archived:, active:) 
- 
def by_archived(relation, archived) 
- 
return relation if archived.nil? 
- 
def projects_cte(archived = nil, active = nil) 
- 
projects = by_archived(projects, archived) 
- 
def subgroups_cte(archived = nil, active = nil) 
- 
subgroups = by_archived(subgroups, archived) 
- 
@project_count ||= try(:preloaded_project_count) || projects.non_archived.count 
 
- 
- 
app/models/user.rb - 
authorized_projects(Gitlab::Access::PLANNER).non_archived.with_issues_enabled 
- 
non_archived: true, 
- 
non_archived: true, 
- 
params = { reviewer_id: id, state: 'opened', non_archived: true, review_states: %w[unapproved unreviewed review_started] } 
- 
IssuesFinder.new(self, assignee_id: self.id, state: 'opened', non_archived: true).execute.count 
 
- 
- 
app/finders/joined_groups_finder.rb 
- 
app/finders/admin/projects_finder.rb 
- 
app/finders/namespaces/projects_finder.rb - 
# include_archived: boolean 
- 
# archived_only: boolean 
- 
collection = by_archived(collection) 
- 
def by_archived(items) 
- 
return items.archived if Gitlab::Utils.to_boolean(params[:archived_only], default: false) 
- 
return items if Gitlab::Utils.to_boolean(params[:include_archived], default: true) 
- 
items.non_archived 
 
- 
- 
app/finders/group_descendants_finder.rb 
- 
ee/app/models/ee/organizations/organization.rb 
- 
app/graphql/resolvers/namespace_projects_resolver.rb 
- 
app/controllers/groups/children_controller.rb 
- 
app/controllers/dashboard/application_controller.rb 
- 
app/controllers/dashboard/projects_controller.rb 
- 
app/controllers/explore/projects_controller.rb 
- 
app/controllers/groups_controller.rb 
- 
app/controllers/concerns/params_backward_compatibility.rb 
- 
app/controllers/concerns/group_tree.rb 
- 
app/helpers/projects_helper.rb - 
is_project_archived: project.archived.to_s, 
- 
project.persisted? && !project.self_deletion_scheduled? && can?(current_user, :archive_project, project) 
- 
def project_archive_settings_app_data(project) 
- 
help_path: help_page_path('user/project/working_with_projects.md', anchor: 'archive-a-project') 
- 
def project_unarchive_settings_app_data(project) 
- 
ancestors_archived: project.ancestors_archived?.to_s, 
- 
help_path: help_page_path('user/project/working_with_projects.md', anchor: 'unarchive-a-project') 
 
- 
- 
app/helpers/groups_helper.rb 
- 
app/helpers/namespaces/deletable_helper.rb 
- 
app/services/groups/merge_requests_count_service.rb 
- 
ee/app/policies/ee/group_policy.rb 
- 
ee/app/models/concerns/ee/loaded_in_group_list.rb 
- 
ee/app/helpers/ee/projects_helper.rb 
- 
lib/sidebars/projects/menus/settings_menu.rb 
- 
lib/api/helpers.rb 
- 
ee/app/models/ee/group.rb