FIX: Plugin JS failing to load would break admin interface (#29139)

If a plugin's JS fails to load for some reason, most commonly
ad blockers, the entire admin interface would break. This is because
we are adding links to the admin routes for plugins that define
them in the sidebar.

We have a fix for this already in the plugin list which shows a warning
to the admin. This fix just prevents the broken link from rendering
in the sidebar if the route is not valid.
This commit is contained in:
Martin Brennan
2024-10-11 09:26:10 +10:00
committed by GitHub
parent 75a7b8f8fd
commit 2193667e1f
9 changed files with 61 additions and 44 deletions

View File

@@ -117,6 +117,18 @@ class Plugin::Instance
}
end
def full_admin_route
route = self.admin_route
return unless route
route
.slice(:location, :label, :use_new_show_route)
.tap do |admin_route|
path = admin_route[:use_new_show_route] ? "show" : admin_route[:location]
admin_route[:full_location] = "adminPlugins.#{path}"
end
end
def configurable?
true
end