Return correct message when pushing to archived group's project
What does this MR do and why?
Previously, when attempting to push to a project whose parent group
was archived, users received a generic You are not allowed to push code to this project message. This was misleading as the actual
reason was the archived status of the parent group.
This commit updates the archive check to use
self_or_ancestors_archived? instead of just checking the project's
archived status. Now users will see the more accurate message You can't push code to an archived project regardless of whether the
project itself or its parent group is archived.
References
How to set up and validate locally
- Create a group and add a project to it
- Enable the FF
Feature.enable :archive_group - Archive the parent group via the group settings
- Attempt to push code to the project using git push
- Verify the error message displays: "You can't push code to an archived project" instead of "You are not allowed to push code to this 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 #578817 (closed)
Edited by Andrew Evans