fix search features

This commit is contained in:
ThatOneCalculator 2023-06-11 23:25:10 -07:00
parent 266534d35c
commit 703b34c07c
No known key found for this signature in database
GPG Key ID: 8703CACD01000000
3 changed files with 10 additions and 25 deletions

View File

@ -59,21 +59,17 @@
v-if="input && input.type !== 'paragraph'"
v-model="inputValue"
autofocus
:type="
input.type == 'searchAdvanced'
? 'search'
: input.type || 'text'
"
:type="input.type == 'search' ? 'search' : input.type || 'text'"
:placeholder="input.placeholder || undefined"
@keydown="onInputKeydown"
:style="{
width: input.type === 'searchAdvanced' ? '300px' : null,
width: input.type === 'search' ? '300px' : null,
}"
>
<template v-if="input.type === 'password'" #prefix
><i class="ph-password ph-bold ph-lg"></i
></template>
<template v-if="input.type === 'searchAdvanced'" #suffix>
<template v-if="input.type === 'search'" #suffix>
<button
class="_buttonIcon"
@click.stop="openSearchFilters"
@ -256,7 +252,7 @@ const inputEl = ref<typeof MkInput>();
function done(canceled: boolean, result?) {
emit("done", { canceled, result });
modal.value?.close();
modal.value?.close(ev);
}
async function ok() {

View File

@ -4,21 +4,8 @@ import { mainRouter } from "@/router";
import { instance } from "@/instance";
export async function search() {
// const 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 searchFiltersAvailable = instance.searchFilters;
const { canceled, result: query } = await os.inputText({
type: searchFiltersAvailable ? "searchAdvanced" : "search",
type: instance.features.searchFilters ? "search" : "text",
title: i18n.ts.search,
placeholder: i18n.ts.searchPlaceholder,
});

View File

@ -39,7 +39,9 @@
:meta="meta"
/>
<XMeili
v-else-if="instance.searchFilters && widgetProps.view === 5"
v-else-if="
instance.features.searchFilters && widgetProps.view === 5
"
:connection="connection"
:meta="meta"
/>
@ -110,8 +112,8 @@ os.api("server-info", {}).then((res) => {
const toggleView = () => {
if (
(widgetProps.view === 5 && instance.searchFilters) ||
(widgetProps.view === 4 && !instance.searchFilters)
(widgetProps.view === 5 && instance.features.searchFilters) ||
(widgetProps.view === 4 && !instance.features.searchFilters)
) {
widgetProps.view = 0;
} else {