mirror of
https://github.com/discourse/discourse.git
synced 2025-05-23 08:51:05 +08:00
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:
@ -446,8 +446,6 @@ class ApplicationController < ActionController::Base
|
||||
current_user.sync_notification_channel_position
|
||||
preload_current_user_data
|
||||
end
|
||||
|
||||
preload_additional_json
|
||||
end
|
||||
|
||||
def set_mobile_view
|
||||
@ -669,12 +667,16 @@ class ApplicationController < ActionController::Base
|
||||
store_preloaded("topicTrackingStates", MultiJson.dump(hash[:data]))
|
||||
store_preloaded("topicTrackingStateMeta", MultiJson.dump(hash[:meta]))
|
||||
|
||||
# This is used in the wizard so we can preload fonts using the FontMap JS API.
|
||||
store_preloaded("fontMap", MultiJson.dump(load_font_map)) if current_user.admin?
|
||||
end
|
||||
if current_user.admin?
|
||||
# This is used in the wizard so we can preload fonts using the FontMap JS API.
|
||||
store_preloaded("fontMap", MultiJson.dump(load_font_map))
|
||||
|
||||
def preload_additional_json
|
||||
# noop, should be defined by subcontrollers
|
||||
# Used to show plugin-specific admin routes in the sidebar.
|
||||
store_preloaded(
|
||||
"enabledPluginAdminRoutes",
|
||||
MultiJson.dump(Discourse.plugins_sorted_by_name.filter_map(&:admin_route)),
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
def custom_html_json
|
||||
|
Reference in New Issue
Block a user