Skip to content

Commit

Permalink
fix: handle no acct string
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe committed Dec 28, 2022
1 parent abe6af4 commit 34dc2f7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions composables/cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export function fetchAccountById(id?: string | null): Promise<Account | null> {
const uri = currentInstance.value?.uri
const promise = useMasto().accounts.fetch(id)
.then((r) => {
if (!r.acct.includes('@') && uri)
if (r.acct && !r.acct.includes('@') && uri)
r.acct = `${r.acct}@${uri}`

cacheAccount(r, server, true)
Expand All @@ -63,7 +63,7 @@ export async function fetchAccountByHandle(acct: string): Promise<Account> {
const uri = currentInstance.value?.uri
const account = useMasto().accounts.lookup({ acct })
.then((r) => {
if (!r.acct.includes('@') && uri)
if (r.acct && !r.acct.includes('@') && uri)
r.acct = `${r.acct}@${uri}`

cacheAccount(r, server, true)
Expand Down
2 changes: 1 addition & 1 deletion composables/masto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export function getShortHandle({ acct }: Account) {
}

export function getServerName(account: Account) {
if (account.acct.includes('@'))
if (account.acct?.includes('@'))
return account.acct.split('@')[1]
// We should only lack the server name if we're on the same server as the account
return currentInstance.value?.uri || ''
Expand Down

0 comments on commit 34dc2f7

Please sign in to comment.