Skip to content

Commit

Permalink
fix: only add domain when none was provided (#2225)
Browse files Browse the repository at this point in the history
  • Loading branch information
natsukagami committed Jul 21, 2023
1 parent 8a86282 commit 2a57c64
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions composables/cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,13 @@ export async function fetchAccountByHandle(acct: string): Promise<mastodon.v1.Ac
async function lookupAccount() {
const client = useMastoClient()
let account: mastodon.v1.Account
if (!isGotoSocial.value) // TODO: GoToSocial will support this endpoint from 0.10.0
if (!isGotoSocial.value) { // TODO: GoToSocial will support this endpoint from 0.10.0
account = await client.v1.accounts.lookup({ acct: userAcct })
else
account = (await client.v1.search({ q: `@${userAcct}@${domain}`, type: 'accounts' })).accounts[0]
}
else {
const userAcctDomain = userAcct.includes('@') ? userAcct : `${userAcct}@${domain}`
account = (await client.v1.search({ q: `@${userAcctDomain}`, type: 'accounts' })).accounts[0]
}

if (account.acct && !account.acct.includes('@') && domain)
account.acct = `${account.acct}@${domain}`
Expand Down

0 comments on commit 2a57c64

Please sign in to comment.