From 1fdbb6c3d3314f9e77a13b07d030a4b98d2c240c Mon Sep 17 00:00:00 2001
From: Arnaud Levy <contact@arnaudlevy.com>
Date: Mon, 19 Jun 2023 16:41:52 +0200
Subject: [PATCH] fix

---
 .../admin/communication/blocks/headings_controller.rb     | 8 --------
 app/models/communication/block/heading.rb                 | 1 +
 2 files changed, 1 insertion(+), 8 deletions(-)

diff --git a/app/controllers/admin/communication/blocks/headings_controller.rb b/app/controllers/admin/communication/blocks/headings_controller.rb
index 3074a898a..329ee2961 100644
--- a/app/controllers/admin/communication/blocks/headings_controller.rb
+++ b/app/controllers/admin/communication/blocks/headings_controller.rb
@@ -24,7 +24,6 @@ class Admin::Communication::Blocks::HeadingsController < Admin::Communication::B
 
   def create
     if @heading.save
-      sync_with_git_if_necessary
       redirect_to about_path,
                   notice: t('admin.successfully_created_html', model: @heading.to_s)
     else
@@ -35,7 +34,6 @@ class Admin::Communication::Blocks::HeadingsController < Admin::Communication::B
 
   def update
     if @heading.update(heading_params)
-      sync_with_git_if_necessary
       redirect_to about_path,
                   notice: t('admin.successfully_updated_html', model: @heading.to_s)
     else
@@ -48,18 +46,12 @@ class Admin::Communication::Blocks::HeadingsController < Admin::Communication::B
   def destroy
     path = about_path
     @heading.destroy
-    sync_with_git_if_necessary
     redirect_to path,
                 notice: t('admin.successfully_destroyed_html', model: @heading.to_s)
   end
 
   protected
 
-  def sync_with_git_if_necessary
-    return unless @heading.about.respond_to?(:sync_with_git)
-    @heading.about.sync_with_git
-  end
-
   # TODO factorize
   def website_id
     params[:website_id] || @heading.about&.website.id
diff --git a/app/models/communication/block/heading.rb b/app/models/communication/block/heading.rb
index 8df785564..bdb9685db 100644
--- a/app/models/communication/block/heading.rb
+++ b/app/models/communication/block/heading.rb
@@ -26,6 +26,7 @@
 #  fk_rails_ae82723550  (university_id => universities.id)
 #
 class Communication::Block::Heading < ApplicationRecord
+  include AsIndirectObject
   include Sanitizable
   include WithPosition
   include WithUniversity
-- 
GitLab