From a624546812af072d23579bce81f85668f9a97c09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=8B=E3=81=A3=E3=81=93=E3=81=8B=E3=82=8A?= <67428053+kakkokari-gtyih@users.noreply.github.com> Date: Thu, 10 Oct 2024 14:05:20 +0900 Subject: [PATCH] =?UTF-8?q?fix(frontend):=20=E3=83=A6=E3=83=BC=E3=82=B6?= =?UTF-8?q?=E3=83=BC=E7=99=BB=E9=8C=B2=E5=AE=8C=E4=BA=86=E6=99=82=E3=81=AB?= =?UTF-8?q?=E3=82=B5=E3=82=A4=E3=83=B3=E3=82=A4=E3=83=B3API=E3=82=92?= =?UTF-8?q?=E5=88=A5=E9=80=94=E4=BD=BF=E7=94=A8=E3=81=97=E3=81=A6=E3=81=84?= =?UTF-8?q?=E3=81=9F=E3=81=AE=E3=82=92=E4=BF=AE=E6=AD=A3=20(#14738)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix(frontend): ユーザー登録完了時にサインインAPIを別途使用していたのを修正 * emitされるオブジェクトの型を変更したことに伴う修正 * Update Changelog --- CHANGELOG.md | 2 +- packages/frontend/src/account.ts | 8 +- packages/frontend/src/components/MkSignin.vue | 4 +- .../src/components/MkSigninDialog.vue | 5 +- .../src/components/MkSignupDialog.form.vue | 84 +++++++++++-------- .../src/components/MkSignupDialog.vue | 4 +- .../src/components/MkUserCardMini.vue | 2 +- .../frontend/src/pages/settings/accounts.vue | 18 ++-- packages/misskey-js/etc/misskey-js.api.md | 4 +- packages/misskey-js/src/entities.ts | 2 +- 10 files changed, 73 insertions(+), 60 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e8909c15da0b..36645aff74ba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ - ### Client -- +- メールアドレス不要でCaptchaが有効な場合にアカウント登録完了後自動でのログインに失敗する問題を修正 ### Server - diff --git a/packages/frontend/src/account.ts b/packages/frontend/src/account.ts index 84d89b1b3f6a..b91834b94f3e 100644 --- a/packages/frontend/src/account.ts +++ b/packages/frontend/src/account.ts @@ -226,7 +226,7 @@ export async function openAccountMenu(opts: { function showSigninDialog() { const { dispose } = popup(defineAsyncComponent(() => import('@/components/MkSigninDialog.vue')), {}, { - done: res => { + done: (res: Misskey.entities.SigninFlowResponse & { finished: true }) => { addAccount(res.id, res.i); success(); }, @@ -236,9 +236,9 @@ export async function openAccountMenu(opts: { function createAccount() { const { dispose } = popup(defineAsyncComponent(() => import('@/components/MkSignupDialog.vue')), {}, { - done: res => { - addAccount(res.id, res.i); - switchAccountWithToken(res.i); + done: (res: Misskey.entities.SignupResponse) => { + addAccount(res.id, res.token); + switchAccountWithToken(res.token); }, closed: () => dispose(), }); diff --git a/packages/frontend/src/components/MkSignin.vue b/packages/frontend/src/components/MkSignin.vue index a79d7cf07a14..a773cefdab9b 100644 --- a/packages/frontend/src/components/MkSignin.vue +++ b/packages/frontend/src/components/MkSignin.vue @@ -83,7 +83,7 @@ import type { AuthenticationPublicKeyCredential } from '@github/webauthn-json/br import type { OpenOnRemoteOptions } from '@/scripts/please-login.js'; const emit = defineEmits<{ - (ev: 'login', v: Misskey.entities.SigninFlowResponse): void; + (ev: 'login', v: Misskey.entities.SigninFlowResponse & { finished: true }): void; }>(); const props = withDefaults(defineProps<{ @@ -276,7 +276,7 @@ async function tryLogin(req: Partial): Promi }); } -async function onLoginSucceeded(res: Misskey.entities.SigninFlowResponse & { finished: true; }) { +async function onLoginSucceeded(res: Misskey.entities.SigninFlowResponse & { finished: true }) { if (props.autoSet) { await login(res.i); } diff --git a/packages/frontend/src/components/MkSigninDialog.vue b/packages/frontend/src/components/MkSigninDialog.vue index 2aa11ac319d8..51dea960aaa7 100644 --- a/packages/frontend/src/components/MkSigninDialog.vue +++ b/packages/frontend/src/components/MkSigninDialog.vue @@ -23,6 +23,7 @@ SPDX-License-Identifier: AGPL-3.0-only diff --git a/packages/frontend/src/components/MkSignupDialog.vue b/packages/frontend/src/components/MkSignupDialog.vue index 4cccd99492da..f240e6dc4690 100644 --- a/packages/frontend/src/components/MkSignupDialog.vue +++ b/packages/frontend/src/components/MkSignupDialog.vue @@ -47,7 +47,7 @@ const props = withDefaults(defineProps<{ }); const emit = defineEmits<{ - (ev: 'done', res: Misskey.entities.SigninFlowResponse): void; + (ev: 'done', res: Misskey.entities.SignupResponse): void; (ev: 'closed'): void; }>(); @@ -55,7 +55,7 @@ const dialog = shallowRef>(); const isAcceptedServerRule = ref(false); -function onSignup(res: Misskey.entities.SigninFlowResponse) { +function onSignup(res: Misskey.entities.SignupResponse) { emit('done', res); dialog.value?.close(); } diff --git a/packages/frontend/src/components/MkUserCardMini.vue b/packages/frontend/src/components/MkUserCardMini.vue index b333722dc280..7a2e878931af 100644 --- a/packages/frontend/src/components/MkUserCardMini.vue +++ b/packages/frontend/src/components/MkUserCardMini.vue @@ -23,7 +23,7 @@ import { acct } from '@/filters/user.js'; const props = withDefaults(defineProps<{ user: Misskey.entities.User; - withChart: boolean; + withChart?: boolean; }>(), { withChart: true, }); diff --git a/packages/frontend/src/pages/settings/accounts.vue b/packages/frontend/src/pages/settings/accounts.vue index 08c9261dcf09..1bbedb817ec2 100644 --- a/packages/frontend/src/pages/settings/accounts.vue +++ b/packages/frontend/src/pages/settings/accounts.vue @@ -45,7 +45,7 @@ const init = async () => { }); }; -function menu(account, ev) { +function menu(account: Misskey.entities.UserDetailed, ev: MouseEvent) { os.popupMenu([{ text: i18n.ts.switch, icon: 'ti ti-switch-horizontal', @@ -58,7 +58,7 @@ function menu(account, ev) { }], ev.currentTarget ?? ev.target); } -function addAccount(ev) { +function addAccount(ev: MouseEvent) { os.popupMenu([{ text: i18n.ts.existingAccount, action: () => { addExistingAccount(); }, @@ -68,14 +68,14 @@ function addAccount(ev) { }], ev.currentTarget ?? ev.target); } -async function removeAccount(account) { +async function removeAccount(account: Misskey.entities.UserDetailed) { await _removeAccount(account.id); accounts.value = accounts.value.filter(x => x.id !== account.id); } function addExistingAccount() { const { dispose } = os.popup(defineAsyncComponent(() => import('@/components/MkSigninDialog.vue')), {}, { - done: async res => { + done: async (res: Misskey.entities.SigninFlowResponse & { finished: true }) => { await addAccounts(res.id, res.i); os.success(); init(); @@ -86,17 +86,17 @@ function addExistingAccount() { function createAccount() { const { dispose } = os.popup(defineAsyncComponent(() => import('@/components/MkSignupDialog.vue')), {}, { - done: async res => { - await addAccounts(res.id, res.i); - switchAccountWithToken(res.i); + done: async (res: Misskey.entities.SignupResponse) => { + await addAccounts(res.id, res.token); + switchAccountWithToken(res.token); }, closed: () => dispose(), }); } async function switchAccount(account: any) { - const fetchedAccounts: any[] = await getAccounts(); - const token = fetchedAccounts.find(x => x.id === account.id).token; + const fetchedAccounts = await getAccounts(); + const token = fetchedAccounts.find(x => x.id === account.id)!.token; switchAccountWithToken(token); } diff --git a/packages/misskey-js/etc/misskey-js.api.md b/packages/misskey-js/etc/misskey-js.api.md index 1da8e4e61388..72c236373d03 100644 --- a/packages/misskey-js/etc/misskey-js.api.md +++ b/packages/misskey-js/etc/misskey-js.api.md @@ -3095,7 +3095,9 @@ type SigninWithPasskeyRequest = { // @public (undocumented) type SigninWithPasskeyResponse = { - signinResponse: SigninFlowResponse; + signinResponse: SigninFlowResponse & { + finished: true; + }; }; // @public (undocumented) diff --git a/packages/misskey-js/src/entities.ts b/packages/misskey-js/src/entities.ts index 2ffee40fbada..dd88791ed037 100644 --- a/packages/misskey-js/src/entities.ts +++ b/packages/misskey-js/src/entities.ts @@ -308,7 +308,7 @@ export type SigninWithPasskeyInitResponse = { }; export type SigninWithPasskeyResponse = { - signinResponse: SigninFlowResponse; + signinResponse: SigninFlowResponse & { finished: true }; }; type Values> = T[keyof T];