mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user