Skip to content

Commit

Permalink
Prevent Javascript error if the page will be unlocked
Browse files Browse the repository at this point in the history
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 bc1a1c1)
  • Loading branch information
sascha-karnatz committed Jun 27, 2024
1 parent 325411a commit 04598c6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/views/alchemy/admin/pages/unlock.js.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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] -%>')
})()

0 comments on commit 04598c6

Please sign in to comment.