From 2ff5ed6942b402835b48f83f2b0d2cea8f82d4ed Mon Sep 17 00:00:00 2001 From: taichanne30 Date: Thu, 4 Jul 2024 09:59:15 +0900 Subject: [PATCH 01/24] =?UTF-8?q?refactor(frontend):=20noteSearchAvailable?= =?UTF-8?q?=E3=82=92accounts=E3=81=AB=E7=A7=BB=E5=8B=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/frontend/src/account.ts | 3 +++ packages/frontend/src/pages/search.vue | 5 +---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/frontend/src/account.ts b/packages/frontend/src/account.ts index f99b550a8344..3496377a46b5 100644 --- a/packages/frontend/src/account.ts +++ b/packages/frontend/src/account.ts @@ -14,6 +14,7 @@ import { apiUrl } from '@/config.js'; import { waiting, popup, popupMenu, success, alert } from '@/os.js'; import { misskeyApi } from '@/scripts/misskey-api.js'; import { unisonReload, reloadChannel } from '@/scripts/unison-reload.js'; +import { instance } from '@/instance.js'; // TODO: 他のタブと永続化されたstateを同期 @@ -27,6 +28,8 @@ export const $i = accountData ? reactive(JSON.parse(accountData) as Account) : n export const iAmModerator = $i != null && ($i.isAdmin === true || $i.isModerator === true); export const iAmAdmin = $i != null && $i.isAdmin; +export const notesSearchAvailable = (($i == null && instance.policies.canSearchNotes) || ($i != null && $i.policies.canSearchNotes)); + export function signinRequired() { if ($i == null) throw new Error('signin required'); return $i; diff --git a/packages/frontend/src/pages/search.vue b/packages/frontend/src/pages/search.vue index a3dcda77beb2..3faf2a1c15f6 100644 --- a/packages/frontend/src/pages/search.vue +++ b/packages/frontend/src/pages/search.vue @@ -28,8 +28,7 @@ SPDX-License-Identifier: AGPL-3.0-only import { computed, defineAsyncComponent, ref } from 'vue'; import { i18n } from '@/i18n.js'; import { definePageMetadata } from '@/scripts/page-metadata.js'; -import { $i } from '@/account.js'; -import { instance } from '@/instance.js'; +import { notesSearchAvailable } from '@/account.js'; import MkInfo from '@/components/MkInfo.vue'; import MkHorizontalSwipe from '@/components/MkHorizontalSwipe.vue'; @@ -38,8 +37,6 @@ const XUser = defineAsyncComponent(() => import('./search.user.vue')); const tab = ref('note'); -const notesSearchAvailable = (($i == null && instance.policies.canSearchNotes) || ($i != null && $i.policies.canSearchNotes)); - const headerActions = computed(() => []); const headerTabs = computed(() => [{ From 678c1395c6131f5c94835476de6a48e495993980 Mon Sep 17 00:00:00 2001 From: taichanne30 Date: Thu, 4 Jul 2024 10:04:24 +0900 Subject: [PATCH 02/24] =?UTF-8?q?feat:=20search=E3=83=9A=E3=83=BC=E3=82=B8?= =?UTF-8?q?=E3=81=A7=E3=81=AE=E3=82=AF=E3=82=A8=E3=83=AA=E3=81=AE=E5=8F=97?= =?UTF-8?q?=E5=8F=96=E3=82=8A=E3=81=A8type=E3=81=AB=E3=82=88=E3=82=8B?= =?UTF-8?q?=E8=A1=A8=E7=A4=BA=E3=82=BF=E3=83=96=E3=81=AE=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/frontend/src/pages/search.vue | 24 ++++++++++++++++++---- packages/frontend/src/router/definition.ts | 3 +++ 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/packages/frontend/src/pages/search.vue b/packages/frontend/src/pages/search.vue index 3faf2a1c15f6..8e0863c2f5a3 100644 --- a/packages/frontend/src/pages/search.vue +++ b/packages/frontend/src/pages/search.vue @@ -10,7 +10,7 @@ SPDX-License-Identifier: AGPL-3.0-only
- +
{{ i18n.ts.notesSearchNotAvailable }} @@ -18,24 +18,40 @@ SPDX-License-Identifier: AGPL-3.0-only - + + From 25b2d4ccf9d471f1beb792d3fd0216a458c0ded8 Mon Sep 17 00:00:00 2001 From: taichanne30 Date: Thu, 4 Jul 2024 10:24:26 +0900 Subject: [PATCH 07/24] =?UTF-8?q?style:=20=E3=81=9F=E3=81=A0=E7=85=A7?= =?UTF-8?q?=E4=BC=9A=E9=83=A8=E5=88=86=E3=82=92=E5=9B=B2=E3=81=A3=E3=81=9F?= =?UTF-8?q?=E3=81=A0=E3=81=91=EF=BC=88=E5=8F=AF=E8=AA=AD=E6=80=A7=E7=A2=BA?= =?UTF-8?q?=E4=BF=9D=E3=81=AE=E3=81=9F=E3=82=81=E3=81=AB=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/frontend/src/pages/search.note.vue | 2 ++ packages/frontend/src/pages/search.user.vue | 2 ++ 2 files changed, 4 insertions(+) diff --git a/packages/frontend/src/pages/search.note.vue b/packages/frontend/src/pages/search.note.vue index 4cc4f1b23aa1..81fce68162e3 100644 --- a/packages/frontend/src/pages/search.note.vue +++ b/packages/frontend/src/pages/search.note.vue @@ -129,6 +129,7 @@ async function search() { if (query == null || query === '') return; + //#region AP lookup if (query.startsWith('https://')) { const promise = misskeyApi('ap/show', { uri: query, @@ -146,6 +147,7 @@ async function search() { return; } + //#endregion notePagination.value = { endpoint: 'notes/search', diff --git a/packages/frontend/src/pages/search.user.vue b/packages/frontend/src/pages/search.user.vue index d6033d7f6a70..85d869d9cba7 100644 --- a/packages/frontend/src/pages/search.user.vue +++ b/packages/frontend/src/pages/search.user.vue @@ -58,6 +58,7 @@ async function search() { if (query == null || query === '') return; + //#region AP lookup if (query.startsWith('https://')) { const promise = misskeyApi('ap/show', { uri: query, @@ -75,6 +76,7 @@ async function search() { return; } + //#endregion userPagination.value = { endpoint: 'users/search', From 77bdca1c65d682242a1ec8fd307177f7c68ed508 Mon Sep 17 00:00:00 2001 From: taichanne30 Date: Thu, 4 Jul 2024 10:27:52 +0900 Subject: [PATCH 08/24] refactor: remove unneed import defineProps and withDefaults are compiler micro when using `