FIX: support case insensitive setting lookup (#795)
This commit is contained in:
parent
a5b5c3bebe
commit
36ce88f356
|
@ -44,7 +44,7 @@ module DiscourseAi
|
|||
end
|
||||
|
||||
def setting_name
|
||||
parameters[:setting_name]
|
||||
@setting_name ||= parameters[:setting_name].to_s.downcase.gsub(" ", "_")
|
||||
end
|
||||
|
||||
def invoke
|
||||
|
|
|
@ -30,6 +30,15 @@ RSpec.describe DiscourseAi::AiBot::Tools::SettingContext, if: has_rg? do
|
|||
expect(result[:context]).to include("moderators_view_emails")
|
||||
end
|
||||
|
||||
it "supports spaces and case insensitive setting name" do
|
||||
result = setting_context("moderaTors View Emails").invoke
|
||||
|
||||
expect(result[:setting_name]).to eq("moderators_view_emails")
|
||||
|
||||
expect(result[:context]).to include("site_settings.yml")
|
||||
expect(result[:context]).to include("moderators_view_emails")
|
||||
end
|
||||
|
||||
it "returns the context for plugin setting" do
|
||||
result = setting_context("ai_bot_enabled").invoke
|
||||
|
||||
|
|
Loading…
Reference in New Issue