FIX: Use plugin category name for plugin list (#24477)

Followup to e37fb3042d6f56a27a01614e57bc7029f472b0c9

Some plugins like discourse-ai and discourse-saml do not
nicely change from kebab-case to Title Case (e.g. Ai, Saml),
and anyway this method of getting the plugin name is not
translated either.

Better to use the plugin setting category if it exists,
since that is written by a human and is translated.
This commit is contained in:
Martin Brennan
2023-11-23 08:40:55 +10:00
committed by GitHub
parent 9f7c2d310a
commit e395e5e002
4 changed files with 47 additions and 25 deletions

View File

@ -77,14 +77,16 @@ class Plugin::Instance
def self.find_all(parent_path)
[].tap do |plugins|
# also follows symlinks - http://stackoverflow.com/q/357754
Dir["#{parent_path}/*/plugin.rb"].sort.each do |path|
source = File.read(path)
metadata = Plugin::Metadata.parse(source)
plugins << self.new(metadata, path)
end
Dir["#{parent_path}/*/plugin.rb"].sort.each { |path| plugins << parse_from_source(path) }
end
end
def self.parse_from_source(path)
source = File.read(path)
metadata = Plugin::Metadata.parse(source)
self.new(metadata, path)
end
def initialize(metadata = nil, path = nil)
@metadata = metadata
@path = path