Skip to content
Snippets Groups Projects
Unverified Commit a358f095 authored by Sébastien Gaya's avatar Sébastien Gaya
Browse files

dependencies through blocks

parent d9b4ba12
No related branches found
No related tags found
No related merge requests found
......@@ -84,6 +84,13 @@ module WithGit
end
end
def dependencies_through_blocks(website)
# We select all blocks having this object as dependency
blocks = website.blocks.select { |block| in? block.git_dependencies }
# We map them to their parent object (program, page, etc.)
blocks.map(&:about).uniq.compact
end
def websites_for_self
if is_a? Communication::Website
[self]
......
......@@ -79,6 +79,7 @@ class University::Organization < ApplicationRecord
dependencies.concat active_storage_blobs
end
dependencies += website.menus.to_a
dependencies += dependencies_through_blocks(website) if in_block_dependencies?(website)
dependencies
end
......
......@@ -172,6 +172,7 @@ class University::Person < ApplicationRecord
dependencies << researcher if researcher.for_website?(website)
dependencies << teacher if teacher.for_website?(website)
dependencies += website.menus.to_a
dependencies += dependencies_through_blocks(website) if in_block_dependencies?(website)
dependencies
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment