Skip to content

Commit

Permalink
globalのノートが検索不可能な場合、検索オプションを表示しないように
Browse files Browse the repository at this point in the history
  • Loading branch information
tai-cha committed Jul 17, 2024
1 parent 568e34a commit 759920c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 4 additions & 0 deletions packages/frontend/src/components/MkRadios.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ export default defineComponent({
// なぜかFragmentになることがあるため
if (options.length === 1 && options[0].props == null) options = options[0].children as VNode[];

// vnodeのうちv-if=falseなものを除外する(trueになるものはoptionなど他typeになる)
options = options.filter(vnode => !(typeof vnode.type === 'symbol' && vnode.type.description === 'v-cmt' && vnode.children === 'v-if'));

return () => h('div', {
class: 'novjtcto',
}, [
Expand All @@ -40,6 +43,7 @@ export default defineComponent({
}, options.map(option => h(MkRadio, {
key: option.key as string,
value: option.props?.value,
disabled: option.props?.disabled,
modelValue: value.value,
'onUpdate:modelValue': _v => value.value = _v,
}, () => option.children)),
Expand Down
7 changes: 5 additions & 2 deletions packages/frontend/src/pages/search.note.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ SPDX-License-Identifier: AGPL-3.0-only
<template #label>{{ i18n.ts.host }}</template>
<option value="all" default>{{ i18n.ts.all }}</option>
<option value="local">{{ i18n.ts.local }}</option>
<option value="specified">{{ i18n.ts.specifyHost }}</option>
<option v-if="noteSearchableScope === 'global'" value="specified">{{ i18n.ts.specifyHost }}</option>
</MkRadios>
<MkInput v-model="hostInput" :disabled="hostSelect !== 'specified'" :large="true" type="search">
<MkInput v-if="noteSearchableScope === 'global'" v-model="hostInput" :disabled="hostSelect !== 'specified'" :large="true" type="search">
<template #prefix><i class="ti ti-server"></i></template>
</MkInput>

Expand Down Expand Up @@ -66,6 +66,7 @@ import { useRouter } from '@/router/supplier.js';
import MkUserCardMini from '@/components/MkUserCardMini.vue';
import MkRadios from '@/components/MkRadios.vue';
import { $i } from '@/account.js';
import { instance } from '@/instance.js';

const props = withDefaults(defineProps<{
query?: string;
Expand All @@ -86,6 +87,8 @@ const notePagination = ref<Paging>();
const user = ref<UserDetailed | null>(null);
const hostInput = ref(toRef(props, 'host').value);

const noteSearchableScope = instance.noteSearchableScope ?? 'local';

const hostSelect = ref<'all' | 'local' | 'specified'>('all');

const setHostSelectWithInput = (after:string|undefined|null, before:string|undefined|null) => {
Expand Down

0 comments on commit 759920c

Please sign in to comment.