1
0
Fork 1
mirror of https://github.com/elk-zone/elk.git synced 2024-11-19 23:40:07 +00:00

fix: account followers and following links (#519)

This commit is contained in:
Joaquín Sánchez 2022-12-22 21:15:06 +01:00 committed by GitHub
parent fef082af13
commit 4d8b402b04
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -63,17 +63,21 @@ export function toShortHandle(fullHandle: string) {
return fullHandle
}
export function getAccountRoute(account: Account) {
export function extractAccountHandle(account: Account) {
let handle = getFullHandle(account).slice(1)
const uri = currentInstance.value?.uri ?? currentServer.value
if (currentInstance.value && handle.endsWith(`@${uri}`))
handle = handle.slice(0, -uri.length - 1)
return handle
}
export function getAccountRoute(account: Account) {
return useRouter().resolve({
name: 'account-index',
params: {
server: currentServer.value,
account: handle,
account: extractAccountHandle(account),
},
state: {
account: account as any,
@ -85,7 +89,7 @@ export function getAccountFollowingRoute(account: Account) {
name: 'account-following',
params: {
server: currentServer.value,
account: getFullHandle(account).slice(1),
account: extractAccountHandle(account),
},
state: {
account: account as any,
@ -97,7 +101,7 @@ export function getAccountFollowersRoute(account: Account) {
name: 'account-followers',
params: {
server: currentServer.value,
account: getFullHandle(account).slice(1),
account: extractAccountHandle(account),
},
state: {
account: account as any,
@ -110,7 +114,7 @@ export function getStatusRoute(status: Status) {
name: 'status',
params: {
server: currentServer.value,
account: getFullHandle(status.account).slice(1),
account: extractAccountHandle(status.account),
status: status.id,
},
state: {