DEV: Adjust site setting search limiter (#23589)

DEV: Adjust site setting search limiter

This opens up the site setting search limiter some more so that when
searching for "min length" it will contain
"min_personal_message_post_length" as one of the results, but not open
it up so much so that when searching for "digest",
"pending_users_reminder_delay_minutes" won't show up in the results
because it isn't really related.

Co-authored-by: Jarek Radosz <jradosz@gmail.com>
This commit is contained in:
Blake Erickson 2023-09-14 09:52:25 -06:00 committed by GitHub
parent 3340852328
commit 2427af4c46
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 1 deletions

View File

@ -92,7 +92,7 @@ export default class AdminSiteSettingsController extends Controller {
(item.get("value") || "").toString().toLowerCase().includes(filter);
if (!filterResult && fuzzyRegex && fuzzyRegex.test(setting)) {
// Tightens up fuzzy search results a bit.
const fuzzySearchLimiter = 15;
const fuzzySearchLimiter = 25;
const strippedSetting = setting.replace(/[^a-z0-9]/gi, "");
if (
strippedSetting.length <=

View File

@ -40,6 +40,11 @@ module("Unit | Controller | admin-site-settings", function (hooks) {
value: "",
setting: "pending_users_reminder_delay_minutes",
}),
SiteSetting.create({
description: "",
value: "",
setting: "min_personal_message_post_length",
}),
],
},
];
@ -58,5 +63,13 @@ module("Unit | Controller | admin-site-settings", function (hooks) {
results = controller.performSearch("digest", settings2);
assert.deepEqual(results[0].siteSettings.length, 1);
assert.deepEqual(results[0].siteSettings[0].setting, "digest_logo");
// ensures fuzzy search limiter doesn't limit too much
results = controller.performSearch("min length", settings2);
assert.strictEqual(results[0].siteSettings.length, 1);
assert.strictEqual(
results[0].siteSettings[0].setting,
"min_personal_message_post_length"
);
});
});