mirror of
https://github.com/discourse/discourse.git
synced 2025-05-21 18:12:32 +08:00
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:
@ -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
|
||||
|
Reference in New Issue
Block a user