FIX: Sort plugin list by name properly (#24839)

Some plugins have discourse- prefixed on their name
and some don't, so sorting in the list was inconsistent.

---------

Co-authored-by: Ted Johansson <ted@discourse.org>
This commit is contained in:
Martin Brennan 2023-12-18 11:42:55 +10:00 committed by GitHub
parent a390dc0360
commit 194c84b217
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,6 +2,10 @@
class Admin::PluginsController < Admin::StaffController
def index
render_serialized(Discourse.visible_plugins, AdminPluginSerializer, root: "plugins")
render_serialized(
Discourse.visible_plugins.sort_by { |p| p.name.downcase.delete_prefix("discourse-") },
AdminPluginSerializer,
root: "plugins",
)
end
end