'Discussion is locked' alert is shown when a project's parent is archived

I noticed that when a group is archived, a "Discussion is locked" alert is shown in issues (in child projects), instead of showing "This project is archived and cannot be commented on.".

Screenshot_2025-06-25_at_12.53.02

This is because we expose issue.project.archived? instead of issue.project.project_namespace.self_or_ancestor_archived? in app/serializers/issue_entity.rb.

Likely, the same applies for merge requests.

Note: The archive_group feature flag must be enabled.

Implementation Guide

Subject: Fix project archived banner
---
Index: app/serializers/issue_entity.rb
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/app/serializers/issue_entity.rb b/app/serializers/issue_entity.rb
--- a/app/serializers/issue_entity.rb	(revision 30a34a24658e1b52066f4f208f10e2334c42bc96)
+++ b/app/serializers/issue_entity.rb	(date 1751519690420)
@@ -81,7 +81,7 @@
   end
 
   expose :is_project_archived do |issue|
-    issue.project.archived?
+    issue.project.self_or_ancestors_archived?
   end
 
   expose :archived_project_docs_path, if: ->(issue) { issue.project.archived? } do |issue|
Index: app/serializers/merge_request_noteable_entity.rb
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/app/serializers/merge_request_noteable_entity.rb b/app/serializers/merge_request_noteable_entity.rb
--- a/app/serializers/merge_request_noteable_entity.rb	(revision 30a34a24658e1b52066f4f208f10e2334c42bc96)
+++ b/app/serializers/merge_request_noteable_entity.rb	(date 1751519977521)
@@ -60,7 +60,7 @@
   end
 
   expose :is_project_archived do |merge_request|
-    merge_request.project.archived?
+    merge_request.project.self_or_ancestors_archived?
   end
 
   expose :project_id
Index: app/graphql/types/work_item_type.rb
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/app/graphql/types/work_item_type.rb b/app/graphql/types/work_item_type.rb
--- a/app/graphql/types/work_item_type.rb	(revision 30a34a24658e1b52066f4f208f10e2334c42bc96)
+++ b/app/graphql/types/work_item_type.rb	(date 1751519902492)
@@ -144,7 +144,7 @@
     def archived
       return false if object.project.blank?
 
-      object.project.archived?
+      object.project.self_or_ancestors_archived?
     end
 
     def show_plan_upgrade_promotion
  1. Replace calls to project.archived to project.self_or_ancestors_archived? in the following files:
    • app/serializers/issue_entity.rb
    • app/serializers/merge_request_noteable_entity.rb
    • app/graphql/types/work_item_type.rb
  2. Update the test accordingly.
Edited by 🤖 GitLab Bot 🤖