mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-02 18:40:22 +00:00
refactor: dedupe extension lowercase query helpers
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { normalizeOptionalLowercaseString } from "openclaw/plugin-sdk/text-runtime";
|
||||
import { listMatrixDirectoryGroupsLive, listMatrixDirectoryPeersLive } from "./directory-live.js";
|
||||
import { isMatrixQualifiedUserId, normalizeMatrixMessagingTarget } from "./matrix/target-ids.js";
|
||||
import type {
|
||||
@@ -8,7 +9,7 @@ import type {
|
||||
} from "./runtime-api.js";
|
||||
|
||||
function normalizeLookupQuery(query: string): string {
|
||||
return query.trim().toLowerCase();
|
||||
return normalizeOptionalLowercaseString(query) ?? "";
|
||||
}
|
||||
|
||||
function findExactDirectoryMatches(
|
||||
@@ -20,9 +21,9 @@ function findExactDirectoryMatches(
|
||||
return [];
|
||||
}
|
||||
return matches.filter((match) => {
|
||||
const id = match.id.trim().toLowerCase();
|
||||
const name = match.name?.trim().toLowerCase();
|
||||
const handle = match.handle?.trim().toLowerCase();
|
||||
const id = normalizeOptionalLowercaseString(match.id);
|
||||
const name = normalizeOptionalLowercaseString(match.name);
|
||||
const handle = normalizeOptionalLowercaseString(match.handle);
|
||||
return normalized === id || normalized === name || normalized === handle;
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user