From 63b77950077743b8de33f3ea255126b0bb5ae34b Mon Sep 17 00:00:00 2001 From: kakkokari-gtyih <67428053+kakkokari-gtyih@users.noreply.github.com> Date: Mon, 26 Aug 2024 18:15:34 +0900 Subject: [PATCH] =?UTF-8?q?=E3=83=81=E3=83=A5=E3=83=BC=E3=83=88=E3=83=AA?= =?UTF-8?q?=E3=82=A2=E3=83=AB=E5=AE=8C=E4=BA=86=E5=BE=8C=E3=81=AB=E3=82=A2?= =?UTF-8?q?=E3=82=AB=E3=82=A6=E3=83=B3=E3=83=88=E3=81=AE=E3=82=AD=E3=83=A3?= =?UTF-8?q?=E3=83=83=E3=82=B7=E3=83=A5=E3=81=8C=E6=9B=B4=E6=96=B0=E3=81=95?= =?UTF-8?q?=E3=82=8C=E3=81=AA=E3=81=84=E5=95=8F=E9=A1=8C=E3=82=92=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/frontend/src/boot/common.ts | 12 ++++++++---- .../src/components/MkTutorial.ProfileSettings.vue | 7 ++++--- packages/frontend/src/scripts/achievements.ts | 6 +++++- 3 files changed, 17 insertions(+), 8 deletions(-) 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 }); }