forked from Mirrors/elk
fix: only add domain when none was provided (#2225)
This commit is contained in:
parent
8a86282951
commit
2a57c64fa0
1 changed files with 6 additions and 3 deletions
|
@ -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}`
|
||||
|
|
Loading…
Reference in a new issue