From 120af977a9cb0af4744e590b36e829bfb140ae4a Mon Sep 17 00:00:00 2001 From: syuilo <4439005+syuilo@users.noreply.github.com> Date: Tue, 26 Aug 2025 08:57:36 +0900 Subject: [PATCH] refactoe --- packages/frontend/src/pages/lookup.vue | 17 +++++++---------- packages/frontend/src/pages/my-lists/index.vue | 6 +++--- packages/frontend/src/pages/my-lists/list.vue | 2 +- packages/frontend/src/pages/notifications.vue | 4 ++-- packages/frontend/src/pages/settings/2fa.vue | 6 +++--- .../frontend/src/pages/settings/accounts.vue | 4 ++-- packages/frontend/src/pages/settings/apps.vue | 4 ++-- packages/frontend/src/pages/settings/email.vue | 2 +- 8 files changed, 21 insertions(+), 24 deletions(-) diff --git a/packages/frontend/src/pages/lookup.vue b/packages/frontend/src/pages/lookup.vue index d5ee0cdf97..8a1e952d85 100644 --- a/packages/frontend/src/pages/lookup.vue +++ b/packages/frontend/src/pages/lookup.vue @@ -29,7 +29,7 @@ import MkButton from '@/components/MkButton.vue'; const state = ref<'fetching' | 'done'>('fetching'); -function fetch() { +function _fetch_() { const params = new URL(window.location.href).searchParams; // acctのほうはdeprecated @@ -44,20 +44,18 @@ function fetch() { if (uri.startsWith('https://')) { promise = misskeyApi('ap/show', { uri, - }); - - promise.then(res => { + }).then(res => { if (res.type === 'User') { mainRouter.replace('/@:acct/:page?', { params: { acct: res.host != null ? `${res.object.username}@${res.object.host}` : res.object.username, - } + }, }); } else if (res.type === 'Note') { mainRouter.replace('/notes/:noteId/:initialTab?', { params: { noteId: res.object.id, - } + }, }); } else { os.alert({ @@ -70,12 +68,11 @@ function fetch() { if (uri.startsWith('acct:')) { uri = uri.slice(5); } - promise = misskeyApi('users/show', Misskey.acct.parse(uri)); - promise.then(user => { + promise = misskeyApi('users/show', Misskey.acct.parse(uri)).then(user => { mainRouter.replace('/@:acct/:page?', { params: { acct: user.host != null ? `${user.username}@${user.host}` : user.username, - } + }, }); }); } @@ -96,7 +93,7 @@ function goToMisskey(): void { window.location.href = '/'; } -fetch(); +_fetch_(); const headerActions = computed(() => []); diff --git a/packages/frontend/src/pages/my-lists/index.vue b/packages/frontend/src/pages/my-lists/index.vue index fb31cd542c..0933618f54 100644 --- a/packages/frontend/src/pages/my-lists/index.vue +++ b/packages/frontend/src/pages/my-lists/index.vue @@ -17,8 +17,8 @@ SPDX-License-Identifier: AGPL-3.0-only
-
{{ list.name }} ({{ i18n.tsx.nUsers({ n: `${list.userIds.length}/${$i.policies['userEachUserListsLimit']}` }) }})
- +
{{ list.name }} ({{ i18n.tsx.nUsers({ n: `${list.userIds!.length}/${$i.policies['userEachUserListsLimit']}` }) }})
+
@@ -50,7 +50,7 @@ async function create() { const { canceled, result: name } = await os.inputText({ title: i18n.ts.enterListName, }); - if (canceled) return; + if (canceled || name == null) return; await os.apiWithDialog('users/lists/create', { name: name }); userListsCache.delete(); fetch(); diff --git a/packages/frontend/src/pages/my-lists/list.vue b/packages/frontend/src/pages/my-lists/list.vue index 6b5a797023..eb8e26be3b 100644 --- a/packages/frontend/src/pages/my-lists/list.vue +++ b/packages/frontend/src/pages/my-lists/list.vue @@ -24,7 +24,7 @@ SPDX-License-Identifier: AGPL-3.0-only - +
{{ i18n.ts.addUser }} diff --git a/packages/frontend/src/pages/notifications.vue b/packages/frontend/src/pages/notifications.vue index a8c1fb654c..71c957460c 100644 --- a/packages/frontend/src/pages/notifications.vue +++ b/packages/frontend/src/pages/notifications.vue @@ -31,7 +31,7 @@ import { Paginator } from '@/utility/paginator.js'; const tab = ref('all'); const includeTypes = ref(null); -const excludeTypes = computed(() => includeTypes.value ? notificationTypes.filter(t => !includeTypes.value.includes(t)) : null); +const excludeTypes = computed(() => includeTypes.value ? notificationTypes.filter(t => !includeTypes.value!.includes(t)) : null); const mentionsPaginator = markRaw(new Paginator('notes/mentions', { limit: 10, @@ -71,7 +71,7 @@ const headerActions = computed(() => [tab.value === 'all' ? { text: i18n.ts.markAllAsRead, icon: 'ti ti-check', handler: () => { - os.apiWithDialog('notifications/mark-all-as-read'); + os.apiWithDialog('notifications/mark-all-as-read', {}); }, } : undefined].filter(x => x !== undefined)); diff --git a/packages/frontend/src/pages/settings/2fa.vue b/packages/frontend/src/pages/settings/2fa.vue index 1f98fab618..ca404b43c4 100644 --- a/packages/frontend/src/pages/settings/2fa.vue +++ b/packages/frontend/src/pages/settings/2fa.vue @@ -25,7 +25,7 @@ SPDX-License-Identifier: AGPL-3.0-only
- - + @@ -28,7 +28,7 @@ SPDX-License-Identifier: AGPL-3.0-only - + diff --git a/packages/frontend/src/pages/settings/email.vue b/packages/frontend/src/pages/settings/email.vue index fb8f51041e..469a3c2f1c 100644 --- a/packages/frontend/src/pages/settings/email.vue +++ b/packages/frontend/src/pages/settings/email.vue @@ -74,7 +74,7 @@ import { instance } from '@/instance.js'; const $i = ensureSignin(); -const emailAddress = ref($i.email); +const emailAddress = ref($i.email ?? ''); const onChangeReceiveAnnouncementEmail = (v) => { misskeyApi('i/update', {