Prevent comments on archived groups & projects wikis
When a group or project is archived, we should prevent comments on its wiki like we do for issues, MRs, and epics.
With the following backend changes, we'll disable comments on wikis, but we also need to make the frontend changes:
diff --git a/app/policies/wiki_page_policy.rb b/app/policies/wiki_page_policy.rb
index 9e5173f87ba8..4ab3214d58f7 100644
--- a/app/policies/wiki_page_policy.rb
+++ b/app/policies/wiki_page_policy.rb
@@ -9,6 +9,8 @@ class WikiPagePolicy < BasePolicy
can?(:reporter_access) || can?(:planner_access)
end
+ condition(:self_or_ancestors_archived) { @subject.self_or_ancestors_archived? }
+
rule { can?(:read_wiki) }.policy do
enable :read_wiki_page
enable :read_note
@@ -16,6 +18,10 @@ class WikiPagePolicy < BasePolicy
enable :update_subscription
end
+ rule { self_or_ancestors_archived }.policy do
+ prevent :create_note
+ end
+
rule { can?(:read_wiki) & planner_or_reporter_access }.policy do
enable :mark_note_as_internal
end
Edited by Abdul Wadood