From f844648cbfe057412ea9185d0c954acef9ff8874 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=89=E5=92=B2=E6=99=BA=E5=AD=90?= Date: Tue, 3 Jan 2023 07:00:12 +0800 Subject: [PATCH] fix: repeat server in acct --- composables/users.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/composables/users.ts b/composables/users.ts index 92113b67..f4db917c 100644 --- a/composables/users.ts +++ b/composables/users.ts @@ -98,14 +98,14 @@ async function loginTo(user?: Omit & { account?: AccountCr : Promise.resolve(undefined), ]) + if (!me.acct.includes('@')) + me.acct = `${me.acct}@${instance.uri}` + user.account = me user.pushSubscription = pushSubscription currentUserId.value = me.id instances.value[server] = instance - if (!user.account.acct.includes('@')) - user.account.acct = `${user.account.acct}@${instance.uri}` - if (!users.value.some(u => u.server === user.server && u.token === user.token)) users.value.push(user as UserLogin) } @@ -140,7 +140,11 @@ export function setAccountInfo(userId: string, account: AccountCredentials) { export async function pullMyAccountInfo() { const account = await useMasto().accounts.verifyCredentials() + if (!account.acct.includes('@')) + account.acct = `${account.acct}@${currentInstance.value!.uri}` + setAccountInfo(currentUserId.value, account) + cacheAccount(account, currentServer.value, true) } export function getUsersIndexByUserId(userId: string) { @@ -283,7 +287,7 @@ export function useUserLocalStorage(key: string, initial: () = return computed(() => { const id = currentUser.value?.account.id - ? `${currentUser.value.account.acct}@${currentInstance.value?.uri || currentServer.value}` + ? currentUser.value.account.acct : '[anonymous]' all.value[id] = Object.assign(initial(), all.value[id] || {}) return all.value[id]