From 387c6956cd60951807ba7827b47227193c26648b Mon Sep 17 00:00:00 2001
From: pabois <pierreandre.boissinot@noesya.coop>
Date: Mon, 10 Jan 2022 16:37:38 +0100
Subject: [PATCH] add authors to post save

---
 app/models/communication/website/post.rb        | 2 +-
 app/models/communication/website/with_abouts.rb | 4 +++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/app/models/communication/website/post.rb b/app/models/communication/website/post.rb
index a0414d905..222d9a439 100644
--- a/app/models/communication/website/post.rb
+++ b/app/models/communication/website/post.rb
@@ -73,7 +73,7 @@ class Communication::Website::Post < ApplicationRecord
   end
 
   def git_dependencies(website)
-    [self] + [author] + categories + active_storage_blobs
+    [self] + [author, author&.author] + categories + active_storage_blobs
   end
 
   def git_destroy_dependencies(website)
diff --git a/app/models/communication/website/with_abouts.rb b/app/models/communication/website/with_abouts.rb
index c70963fe6..7606add7a 100644
--- a/app/models/communication/website/with_abouts.rb
+++ b/app/models/communication/website/with_abouts.rb
@@ -42,7 +42,9 @@ module Communication::Website::WithAbouts
   def people
     @people ||= (
       posts.collect(&:author) +
-      programs.collect(&:university_people_through_teachers).flatten
+      posts.collect(&:author).map(&:author) +
+      programs.collect(&:university_people_through_teachers).flatten +
+      programs.collect(&:university_people_through_teachers).flatten.map(&:teacher)
       # TODO researchers via articles
     ).uniq.compact
   end
-- 
GitLab