From e761bd6b2317e20e1d74271699ac05edd7aa5fca Mon Sep 17 00:00:00 2001 From: ThatOneCalculator Date: Mon, 29 May 2023 10:18:12 -0700 Subject: [PATCH] fixes --- packages/backend/src/db/meilisearch.ts | 2 +- packages/client/src/scripts/search.ts | 35 ++++++++++++++++---------- 2 files changed, 23 insertions(+), 14 deletions(-) diff --git a/packages/backend/src/db/meilisearch.ts b/packages/backend/src/db/meilisearch.ts index 95f57a42d..7f3178955 100644 --- a/packages/backend/src/db/meilisearch.ts +++ b/packages/backend/src/db/meilisearch.ts @@ -274,7 +274,7 @@ export default hasConfig note = [note]; } - let deletionBatch = note + const deletionBatch = note .map((n) => { if (n instanceof Note) { return n.id; diff --git a/packages/client/src/scripts/search.ts b/packages/client/src/scripts/search.ts index c6eb497ea..8f1f0a7df 100644 --- a/packages/client/src/scripts/search.ts +++ b/packages/client/src/scripts/search.ts @@ -3,19 +3,30 @@ import { i18n } from "@/i18n"; import { mainRouter } from "@/router"; export async function search() { + let searchOptions = ""; + + let meta = null; + + os.api("server-info", {}).then((res) => { + meta = res; + }); + + if (meta.meilisearch.health === "available") { + searchOptions = + "Advanced search operators\n" + + "from:user => filter by user\n" + + "has:image/video/audio/text/file => filter by attachment types\n" + + "domain:domain.com => filter by domain\n" + + "before:Date => show posts made before Date\n" + + "after:Date => show posts made after Date\n" + + '"text" => get posts with exact text between quotes\n' + + "filter:following => show results only from users you follow\n" + + "filter:followers => show results only from followers\n"; + } const { canceled, result: query } = await os.inputText({ title: i18n.ts.search, placeholder: i18n.ts.searchPlaceholder, - text: - "Advanced search operators\n" + - "from:user => filter by user\n" + - "has:image/video/audio/text/file => filter by attachment types\n" + - "domain:domain.com => filter by domain\n" + - "before:Date => show posts made before Date\n" + - "after:Date => show posts made after Date\n" + - '"text" => get posts with exact text between quotes\n' + - "filter:following => show results only from users you follow\n" + - "filter:followers => show results only from followers\n", + text: searchOptions, }); if (canceled || query == null || query === "") return; @@ -46,9 +57,7 @@ export async function search() { // TODO //v.$root.$emit('warp', date); os.alert({ - icon: "ph-clock-counter-clockwise ph-bold ph-lg", - iconOnly: true, - autoClose: true, + type: "waiting", }); return; }