From d4c88352cf7c58a9d5a65af32832d2b7c6f773ae Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Gaya?= <sebastien.gaya@gmail.com>
Date: Fri, 28 Apr 2023 11:30:17 +0200
Subject: [PATCH] blobs exportable to git

---
 app/models/communication/website/git_file.rb | 1 +
 config/initializers/active_storage.rb        | 4 ++++
 2 files changed, 5 insertions(+)

diff --git a/app/models/communication/website/git_file.rb b/app/models/communication/website/git_file.rb
index b4352b3dc..48b81f6f0 100644
--- a/app/models/communication/website/git_file.rb
+++ b/app/models/communication/website/git_file.rb
@@ -36,6 +36,7 @@ class Communication::Website::GitFile < ApplicationRecord
     # Some objects need to declare that property:
     # - the website itself
     # - configs (which inherit from the website)
+    # - active storage blobs
     return unless object.try(:exportable_to_git?)
     # Permalinks must be calculated BEFORE renders
     manage_permalink object, website
diff --git a/config/initializers/active_storage.rb b/config/initializers/active_storage.rb
index 091896291..111aff7e3 100644
--- a/config/initializers/active_storage.rb
+++ b/config/initializers/active_storage.rb
@@ -46,6 +46,10 @@ Rails.application.config.to_prepare do
     def git_path(website)
       "data/media/#{id[0..1]}/#{id}.yml"
     end
+
+    def exportable_to_git?
+      true
+    end
   end
 
   ActiveStorage::Blob.include ActiveStorageGitPathStatic
-- 
GitLab