diff --git a/components/account/AccountInfo.vue b/components/account/AccountInfo.vue index 1448bde9..986cff86 100644 --- a/components/account/AccountInfo.vue +++ b/components/account/AccountInfo.vue @@ -7,7 +7,7 @@ const { account, link = true, fullServer = false } = defineProps<{ fullServer?: boolean }>() -const id = computed(() => fullServer && !account.acct.includes('@') ? `@${account.acct}@${account.url.match(UserLinkRE)?.[1]}` : getAccountHandle(account)) +const accountHandle = $(useAccountHandle(account, fullServer)) diff --git a/composables/masto.ts b/composables/masto.ts index 28e46b11..623940af 100644 --- a/composables/masto.ts +++ b/composables/masto.ts @@ -45,6 +45,10 @@ export function getStatusPath(status: Status) { return `/status/${status.id}` } +export function useAccountHandle(account: Account, fullServer = true) { + return computed(() => fullServer && !account.acct.includes('@') ? `@${account.acct}@${account.url.match(UserLinkRE)?.[1]}` : getAccountHandle(account)) +} + // Batch requests for relationships when used in the UI // We don't want to hold to old values, so every time a Relationship is needed it // is requested again from the server to show the latest state