From f5cf8f8c50a141367fa8ebbfa0e9e306129b7088 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Gaya?= <sebastien.gaya@gmail.com>
Date: Mon, 5 Dec 2022 16:28:45 +0100
Subject: [PATCH] dependencies

---
 app/models/communication/website/page.rb | 15 ++++++++++++++-
 app/models/university/person.rb          |  1 +
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/app/models/communication/website/page.rb b/app/models/communication/website/page.rb
index bab4221c9..302bb65ba 100644
--- a/app/models/communication/website/page.rb
+++ b/app/models/communication/website/page.rb
@@ -87,9 +87,22 @@ class Communication::Website::Page < ApplicationRecord
                     active_storage_blobs +
                     siblings +
                     git_block_dependencies
-    dependencies += website.education_programs if kind_education_programs?
     dependencies += [parent] if has_parent?
     dependencies += [website.config_permalinks] if is_special_page?
+    dependencies += [
+      website.categories,
+      website.authors.map(&:author),
+      website.posts
+    ].flatten if kind_communication_posts?
+    dependencies += website.education_programs if kind_education_programs?
+    dependencies += website.education_diplomas if kind_education_diplomas?
+    dependencies += website.research_papers if kind_research_papers?
+    dependencies += website.organizations if kind_organizations?
+    dependencies += website.people_with_facets if kind_persons?
+    dependencies += website.administrators.map(&:administrator) if kind_administrators?
+    dependencies += website.authors.map(&:author) if kind_authors?
+    dependencies += website.researchers.map(&:researcher) if kind_researchers?
+    dependencies += website.teachers.map(&:teacher) if kind_teachers?
     dependencies.flatten
   end
 
diff --git a/app/models/university/person.rb b/app/models/university/person.rb
index e18db0cae..0b62f073d 100644
--- a/app/models/university/person.rb
+++ b/app/models/university/person.rb
@@ -185,6 +185,7 @@ class University::Person < ApplicationRecord
     dependencies += active_storage_blobs
     dependencies += git_block_dependencies
     dependencies += [administrator, author, researcher, teacher]
+    dependencies += communication_website_posts.where(communication_website_id: website.id)
     dependencies += website.menus.to_a
     dependencies += dependencies_through_blocks(website)
     dependencies
-- 
GitLab