FIX: Always preload admin plugin list for admin in sidebar (#25606)

When we show the links to installed plugins in the admin
sidebar (for plugins that have custom admin routes) we were
previously only doing this if you opened /admin, not if you
navigated there from the main forum. We should just always
preload this data if the user is admin.

This commit also changes `admin_sidebar_enabled_groups` to
not be sent to the client as part of ongoing efforts to
not check groups on the client, since not all a user's groups
may be serialized.
This commit is contained in:
Martin Brennan
2024-02-09 12:52:22 +10:00
committed by GitHub
parent 110d544225
commit 3cc73cfd1e
13 changed files with 73 additions and 67 deletions

View File

@ -7,13 +7,4 @@ class Admin::AdminController < ApplicationController
def index
render body: nil
end
private
def preload_additional_json
store_preloaded(
"enabledPluginAdminRoutes",
MultiJson.dump(Discourse.plugins_sorted_by_name.filter_map(&:admin_route)),
)
end
end