From 4bd399f32133a7485e3d81c9e4f3a49f66338dde Mon Sep 17 00:00:00 2001 From: ThatOneCalculator Date: Sat, 4 Feb 2023 12:41:25 -0800 Subject: [PATCH] chore: formatting --- packages/backend/src/misc/nyaize.ts | 6 +++--- .../backend/src/server/api/endpoints/notes/search-by-tag.ts | 5 +++-- packages/client/src/components/MkEmojiPicker.vue | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/packages/backend/src/misc/nyaize.ts b/packages/backend/src/misc/nyaize.ts index 7ec26c1eb7..b85f1d918e 100644 --- a/packages/backend/src/misc/nyaize.ts +++ b/packages/backend/src/misc/nyaize.ts @@ -2,9 +2,9 @@ export function nyaize(text: string): string { return ( text // ja-JP - .replace(/な/g, "にゃ") - .replace(/ナ/g, "ニャ") - .replace(/ナ/g, "ニャ") + .replaceAll("な", "にゃ") + .replaceAll("ナ", "ニャ") + .replaceAll("ナ", "ニャ") // en-US .replace(/(?<=n)a/gi, (x) => (x === "A" ? "YA" : "ya")) .replace(/(?<=morn)ing/gi, (x) => (x === "ING" ? "YAN" : "yan")) diff --git a/packages/backend/src/server/api/endpoints/notes/search-by-tag.ts b/packages/backend/src/server/api/endpoints/notes/search-by-tag.ts index 8993237421..d8d0dbbf73 100644 --- a/packages/backend/src/server/api/endpoints/notes/search-by-tag.ts +++ b/packages/backend/src/server/api/endpoints/notes/search-by-tag.ts @@ -93,7 +93,7 @@ export default define(meta, paramDef, async (ps, me) => { try { if (ps.tag) { - if (!safeForSql(normalizeForSearch(ps.tag))) throw 'Injection'; + if (!safeForSql(normalizeForSearch(ps.tag))) throw "Injection"; query.andWhere(`'{"${normalizeForSearch(ps.tag)}"}' <@ note.tags`); } else { query.andWhere( @@ -102,7 +102,8 @@ export default define(meta, paramDef, async (ps, me) => { qb.orWhere( new Brackets((qb) => { for (const tag of tags) { - if (!safeForSql(normalizeForSearch(ps.tag))) throw 'Injection'; + if (!safeForSql(normalizeForSearch(ps.tag))) + throw "Injection"; qb.andWhere(`'{"${normalizeForSearch(tag)}"}' <@ note.tags`); } }), diff --git a/packages/client/src/components/MkEmojiPicker.vue b/packages/client/src/components/MkEmojiPicker.vue index ac19832553..b26eb12060 100644 --- a/packages/client/src/components/MkEmojiPicker.vue +++ b/packages/client/src/components/MkEmojiPicker.vue @@ -316,7 +316,7 @@ function done(query?: any): boolean | void { if (query == null) query = q.value; if (query == null || typeof query !== 'string') return; - const q2 = query.replace(/:/g, ''); + const q2 = query.replaceAll(':', ''); const exactMatchCustom = customEmojis.find(emoji => emoji.name === q2); if (exactMatchCustom) { chosen(exactMatchCustom);