Fix re-archiving projects and subgroups after group unarchive

What does this MR do and why?

When a group was unarchived, the unarchive_descendants! and unarchive_all_projects! methods only updated namespace_settings.archived and projects.archived columns but did not reset the namespaces.state column. This left the state machine in an archived state, preventing projects and subgroups from being re-archived later. Update both methods to also reset namespaces.state to ancestor_inherited for previously archived descendants and project namespaces.

Query plans

How to set up and validate locally

Follow these steps on the master branch, and the project archival should fail. On this branch, project archival should succeed after following these steps:

  1. Create a new group
  2. Create a project inside that group
  3. Archive the project
  4. Navigate to the group's Settings > General > Advanced
  5. Click "Archive" to archive the group
  6. Click "Unarchive" to unarchive the group
  7. Navigate to the project's Settings > General > Advanced
  8. Click "Archive" to archive the project

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #590990 (closed)

Edited by Abdul Wadood

Merge request reports

Loading