diff --git a/components/account/AccountHeader.vue b/components/account/AccountHeader.vue
index ffbcfb0f..eade033f 100644
--- a/components/account/AccountHeader.vue
+++ b/components/account/AccountHeader.vue
@@ -59,7 +59,7 @@ function getFieldNameIcon(fieldName: string) {
- {{ getAccountHandle(account) }}
+ {{ getShortHandle(account) }}
@@ -86,13 +86,13 @@ function getFieldNameIcon(fieldName: string) {
-
+
{{ account.statusesCount }} Posts
-
+
{{ account.followingCount }} Following
-
+
{{ account.followersCount }} Followers
diff --git a/components/account/AccountHoverCard.vue b/components/account/AccountHoverCard.vue
index e05cb5f2..41d29c9c 100644
--- a/components/account/AccountHoverCard.vue
+++ b/components/account/AccountHoverCard.vue
@@ -10,15 +10,15 @@ defineProps<{
-
+
{{ account.statusesCount }} Posts
•
-
+
{{ account.followingCount }} Following
•
-
+
{{ account.followersCount }} Followers
diff --git a/components/nav/NavSide.vue b/components/nav/NavSide.vue
index e1163149..2d41a2d3 100644
--- a/components/nav/NavSide.vue
+++ b/components/nav/NavSide.vue
@@ -54,7 +54,7 @@
Bookmarks
-
+
Profile
diff --git a/components/user/UserSwitcher.vue b/components/user/UserSwitcher.vue
index 64e1d2b7..1349528d 100644
--- a/components/user/UserSwitcher.vue
+++ b/components/user/UserSwitcher.vue
@@ -41,7 +41,7 @@ const sorted = computed(() => {
@click="signout"
>
- Sign out {{ getAccountHandle(currentUser.account) }}
+ Sign out {{ getShortHandle(currentUser.account) }}
diff --git a/composables/masto.ts b/composables/masto.ts
index 623940af..a7f742f2 100644
--- a/composables/masto.ts
+++ b/composables/masto.ts
@@ -33,12 +33,28 @@ export function getDisplayName(account: Account) {
return account.displayName || account.username
}
-export function getAccountHandle(account: Account) {
+export function getShortHandle(account: Account) {
return `@${account.acct}`
}
+export function getFullHandle(account: Account) {
+ const handle = `@${account.acct}`
+ if (!currentUser.value || account.acct.includes('@'))
+ return handle
+ return `${handle}@${account.url.match(UserLinkRE)?.[1] || currentUser.value.server}`
+}
+
+export function toShortHandle(fullHandle: string) {
+ if (!currentUser.value)
+ return fullHandle
+ const server = currentUser.value.server
+ if (fullHandle.endsWith(`@${server}`))
+ return fullHandle.slice(0, -server.length - 1)
+ return fullHandle
+}
+
export function getAccountPath(account: Account) {
- return `/${getAccountHandle(account)}`
+ return `/${getFullHandle(account)}`
}
export function getStatusPath(status: Status) {
@@ -46,7 +62,10 @@ export function getStatusPath(status: Status) {
}
export function useAccountHandle(account: Account, fullServer = true) {
- return computed(() => fullServer && !account.acct.includes('@') ? `@${account.acct}@${account.url.match(UserLinkRE)?.[1]}` : getAccountHandle(account))
+ return computed(() => fullServer
+ ? getFullHandle(account)
+ : getShortHandle(account),
+ )
}
// Batch requests for relationships when used in the UI
diff --git a/pages/@[account].vue b/pages/@[account].vue
index 5ab8f312..ead51051 100644
--- a/pages/@[account].vue
+++ b/pages/@[account].vue
@@ -1,6 +1,6 @@