From a92858944d4109369589cd7da5fda1525600a24f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=82=AA=E3=82=B9=E3=82=AB=E3=83=BC=E3=80=81?= Date: Sat, 2 Nov 2024 20:31:15 +0900 Subject: [PATCH] fix(onboarding): redirecting to tutorial even if completed tutorial --- packages/frontend/src/boot/common.ts | 9 ++++++++- packages/frontend/src/store.ts | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/frontend/src/boot/common.ts b/packages/frontend/src/boot/common.ts index 869680683..6f6ce18f7 100644 --- a/packages/frontend/src/boot/common.ts +++ b/packages/frontend/src/boot/common.ts @@ -15,6 +15,7 @@ import { updateI18n } from '@/i18n.js'; import { $i, iAmAdmin, refreshAccount, login } from '@/account.js'; import { defaultStore, ColdDeviceStorage } from '@/store.js'; import { fetchInstance, instance } from '@/instance.js'; +import { claimedAchievements } from '@/scripts/achievements.js'; import { deviceKind } from '@/scripts/device-kind.js'; import { reloadChannel } from '@/scripts/unison-reload.js'; import { getUrlWithoutLoginId } from '@/scripts/login-id.js'; @@ -119,7 +120,13 @@ export async function common(createVue: () => App) { await deckStore.ready; // 2024年4月1日JST以降に作成されたアカウントで、チュートリアルを完了していない通常ユーザーの場合、チュートリアルにリダイレクト - if (!instance.canSkipInitialTutorial && $i && !iAmAdmin && defaultStore.state.accountSetupWizard !== -1 && !location.pathname.startsWith('/onboarding') && !location.pathname.startsWith('/signup-complete')) { + if ( + !instance.canSkipInitialTutorial && + $i && !iAmAdmin && + !claimedAchievements.includes('tutorialCompleted') && + !location.pathname.startsWith('/onboarding') && + !location.pathname.startsWith('/signup-complete') + ) { const param = new URLSearchParams(); param.set('redirected_from', location.pathname + location.search + location.hash); location.replace('/onboarding?' + param.toString()); diff --git a/packages/frontend/src/store.ts b/packages/frontend/src/store.ts index 46fd86bdb..930cfbc8b 100644 --- a/packages/frontend/src/store.ts +++ b/packages/frontend/src/store.ts @@ -64,7 +64,7 @@ export const pageViewInterruptors: PageViewInterruptor[] = []; // あと、現行の定義の仕方なら「whereが何であるかに関わらずキー名の重複不可」という制約を付けられるメリットもあるからそのメリットを引き継ぐ方法も考えないといけない export const defaultStore = markRaw(new Storage('base', { accountSetupWizard: { - where: 'account', + where: 'deviceAccount', default: 0, }, timelineTutorials: {