From 2031d7296e919e98d550a7dc2dd69dd26482bfeb Mon Sep 17 00:00:00 2001
From: Justin Coyne <jcoyne@justincoyne.com>
Date: Mon, 16 Dec 2024 15:39:55 -0600
Subject: [PATCH] Avoid rendering partials on the embed component

render_document_partials is deprecated

Fixes #3362
---
 .../spotlight/solr_document_legacy_embed_component.html.erb | 4 ----
 app/models/spotlight/blacklight_configuration.rb            | 4 ++--
 .../spotlight/sir_trevor/blocks/_embedded_document.html.erb | 6 +-----
 3 files changed, 3 insertions(+), 11 deletions(-)

diff --git a/app/components/spotlight/solr_document_legacy_embed_component.html.erb b/app/components/spotlight/solr_document_legacy_embed_component.html.erb
index c428f9208..d1a05e31d 100644
--- a/app/components/spotlight/solr_document_legacy_embed_component.html.erb
+++ b/app/components/spotlight/solr_document_legacy_embed_component.html.erb
@@ -1,9 +1,5 @@
 <% if body.present? %>
   <%= body %>
-<% elsif partials? %>
-  <% partials.each do |partial| %>
-    <%= partial %>
-  <% end %>
 <% elsif embed? %>
   <%= embed %>
 <% elsif thumbnail? %>
diff --git a/app/models/spotlight/blacklight_configuration.rb b/app/models/spotlight/blacklight_configuration.rb
index e2b0badd7..d15b2e3bb 100644
--- a/app/models/spotlight/blacklight_configuration.rb
+++ b/app/models/spotlight/blacklight_configuration.rb
@@ -121,10 +121,10 @@ def blacklight_config
         config.default_per_page = default_per_page if default_per_page
 
         config.view.embed!
-        # This is blacklight-gallery's openseadragon partial
+        # This is blacklight-gallery's openseadragon component
         unless config.view.embed.document_component
-          config.view.embed.partials ||= ['openseadragon']
           config.view.embed.document_component = Spotlight::SolrDocumentLegacyEmbedComponent
+          config.view.embed.embed_component = Blacklight::Gallery::OpenseadragonEmbedComponent
         end
         config.view.embed.if = false
 
diff --git a/app/views/spotlight/sir_trevor/blocks/_embedded_document.html.erb b/app/views/spotlight/sir_trevor/blocks/_embedded_document.html.erb
index 160b8ea15..0ec3585e2 100644
--- a/app/views/spotlight/sir_trevor/blocks/_embedded_document.html.erb
+++ b/app/views/spotlight/sir_trevor/blocks/_embedded_document.html.erb
@@ -1,8 +1,4 @@
 <div class="box" data-id="<%= document.id %>">
   <% view_config = blacklight_config.view_config(:embed) %>
-  <%= render (view_config.document_component || Spotlight::SolrDocumentLegacyEmbedComponent).new((Blacklight.version > '8.0' ? :document : :presenter) => document_presenter(document, view_config: view_config), counter: nil, block: local_assigns[:block]) do |component| %>
-    <% component.with_partial do %>
-      <%= render_document_partials document, view_config.partials, component: component, document_counter: nil, view_config: view_config, block: local_assigns[:block], **(view_config.locals) %>
-    <% end if view_config&.partials&.any? %>
-  <% end %>
+  <%= render (view_config.document_component || Spotlight::SolrDocumentLegacyEmbedComponent).new((Blacklight.version > '8.0' ? :document : :presenter) => document_presenter(document, view_config: view_config), counter: nil, block: local_assigns[:block]) %>
 </div>