From e75cc9edf2ffa5e48c00ca634804935c9319a9b1 Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Sun, 4 Dec 2022 13:19:47 +0000 Subject: [PATCH] fix: handle account uris that differ from server url --- composables/cache.ts | 3 +++ composables/users.ts | 3 +++ 2 files changed, 6 insertions(+) diff --git a/composables/cache.ts b/composables/cache.ts index bb863966..cab48bda 100644 --- a/composables/cache.ts +++ b/composables/cache.ts @@ -49,6 +49,9 @@ export async function fetchAccountByHandle(acct: string): Promise { return cached const account = useMasto().accounts.lookup({ acct }) .then((r) => { + if (!r.acct.includes('@') && currentInstance.value) + r.acct = `${r.acct}@${currentInstance.value.uri}` + cacheAccount(r, true) return r }) diff --git a/composables/users.ts b/composables/users.ts index 547c7dc1..fc769f19 100644 --- a/composables/users.ts +++ b/composables/users.ts @@ -58,6 +58,9 @@ export async function loginTo(user?: Omit & { account?: Ac currentUserId.value = me.id servers.value[me.id] = server + if (!user.account.acct.includes('@')) + user.account.acct = `${user.account.acct}@${server.uri}` + if (!users.value.some(u => u.server === user.server && u.token === user.token)) users.value.push(user as UserLogin) }