From a037a78a4ac7665573decabaa4093f43706c3bba Mon Sep 17 00:00:00 2001 From: Sascha Karnatz <122262394+sascha-karnatz@users.noreply.github.com> Date: Thu, 27 Jun 2024 12:15:10 +0200 Subject: [PATCH] Prevent Javascript error if the page will be unlocked Make an undefined check to the locked status label which is only available in page tree view. If user is closing the tab in page edit view (or any other view) it will result in a javascript error. (cherry picked from commit bc1a1c14f522eaf9ed308655fd23af6e3deb29c5) --- app/views/alchemy/admin/pages/unlock.js.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/alchemy/admin/pages/unlock.js.erb b/app/views/alchemy/admin/pages/unlock.js.erb index bf9e659a83..b6596cd292 100644 --- a/app/views/alchemy/admin/pages/unlock.js.erb +++ b/app/views/alchemy/admin/pages/unlock.js.erb @@ -15,6 +15,6 @@ } locked_page_icon.outerHTML = locked_page_icon_content } - document.querySelector("#page_<%= @page.id -%> .page_status.locked").remove() + document.querySelector("#page_<%= @page.id -%> .page_status.locked")?.remove() Alchemy.growl('<%= flash[:notice] -%>') })()