fix: handle account uris that differ from server url

This commit is contained in:
Daniel Roe 2022-12-04 13:19:47 +00:00
parent 20d8aa7e75
commit e75cc9edf2
No known key found for this signature in database
GPG key ID: 22D5008E4F5D9B55
2 changed files with 6 additions and 0 deletions

View file

@ -49,6 +49,9 @@ export async function fetchAccountByHandle(acct: string): Promise<Account> {
return cached return cached
const account = useMasto().accounts.lookup({ acct }) const account = useMasto().accounts.lookup({ acct })
.then((r) => { .then((r) => {
if (!r.acct.includes('@') && currentInstance.value)
r.acct = `${r.acct}@${currentInstance.value.uri}`
cacheAccount(r, true) cacheAccount(r, true)
return r return r
}) })

View file

@ -58,6 +58,9 @@ export async function loginTo(user?: Omit<UserLogin, 'account'> & { account?: Ac
currentUserId.value = me.id currentUserId.value = me.id
servers.value[me.id] = server 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)) if (!users.value.some(u => u.server === user.server && u.token === user.token))
users.value.push(user as UserLogin) users.value.push(user as UserLogin)
} }