diff --git a/packages/frontend/src/boot/common.ts b/packages/frontend/src/boot/common.ts index b5d716dc3c..ef650e5054 100644 --- a/packages/frontend/src/boot/common.ts +++ b/packages/frontend/src/boot/common.ts @@ -129,10 +129,14 @@ export async function common(createVue: () => App) { !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()); - return; + await refreshAccount(); + + if ($i && !$i.achievements.map((v) => v.name).includes('tutorialCompleted')) { + const param = new URLSearchParams(); + param.set('redirected_from', location.pathname + location.search + location.hash); + location.replace('/onboarding?' + param.toString()); + return; + } } const fetchInstanceMetaPromise = fetchInstance(); diff --git a/packages/frontend/src/components/MkTutorial.ProfileSettings.vue b/packages/frontend/src/components/MkTutorial.ProfileSettings.vue index b1a1b6eff7..072deca421 100644 --- a/packages/frontend/src/components/MkTutorial.ProfileSettings.vue +++ b/packages/frontend/src/components/MkTutorial.ProfileSettings.vue @@ -39,7 +39,7 @@ import FormSlot from '@/components/form/slot.vue'; import MkInfo from '@/components/MkInfo.vue'; import { selectFile } from '@/scripts/select-file.js'; import * as os from '@/os.js'; -import { signinRequired } from '@/account.js'; +import { signinRequired, updateAccount } from '@/account.js'; import type { TutorialPageCommonExpose } from '@/components/MkTutorial.vue'; const $i = signinRequired(); @@ -53,6 +53,7 @@ watch(name, () => { // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing name: name.value || null, }); + updateAccount({ name: name.value }); }); watch(description, () => { @@ -61,6 +62,7 @@ watch(description, () => { // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing description: description.value || null, }); + updateAccount({ description: description.value }); }); function setAvatar(ev: MouseEvent) { @@ -83,8 +85,7 @@ function setAvatar(ev: MouseEvent) { const i = await os.apiWithDialog('i/update', { avatarId: originalOrCropped.id, }); - $i.avatarId = i.avatarId; - $i.avatarUrl = i.avatarUrl; + updateAccount({ avatarId: i.avatarId, avatarUrl: i.avatarUrl }); }); } diff --git a/packages/frontend/src/scripts/achievements.ts b/packages/frontend/src/scripts/achievements.ts index f5d0ab559f..cdd4379124 100644 --- a/packages/frontend/src/scripts/achievements.ts +++ b/packages/frontend/src/scripts/achievements.ts @@ -4,7 +4,7 @@ */ import { misskeyApi } from '@/scripts/misskey-api.js'; -import { $i } from '@/account.js'; +import { $i, refreshAccount } from '@/account.js'; export const ACHIEVEMENT_TYPES = [ 'notes1', @@ -500,6 +500,10 @@ export async function claimAchievement(type: typeof ACHIEVEMENT_TYPES[number]) { await new Promise(resolve => setTimeout(resolve, (claimingQueue.size - 1) * 500)); window.setTimeout(() => { claimingQueue.delete(type); + + if (claimingQueue.size === 0) { + refreshAccount(); + } }, 500); misskeyApi('i/claim-achievement', { name: type }); }