Show "Alias" badge on profile page if account has aliases
This commit is contained in:
parent
177639614a
commit
2984d369a1
3 changed files with 26 additions and 0 deletions
|
@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|||
|
||||
## [Unreleased]
|
||||
|
||||
### Added
|
||||
|
||||
- Show "Alias" badge on profile page if account has aliases.
|
||||
|
||||
### Changed
|
||||
|
||||
- Use `/feeds/users/{username}` path for user's Atom feed.
|
||||
|
|
|
@ -352,3 +352,13 @@ export async function createIdentityProof(
|
|||
return data
|
||||
}
|
||||
}
|
||||
|
||||
export async function getAliases(profileId: string): Promise<Profile[]> {
|
||||
const url = `${BACKEND_URL}/api/v1/accounts/${profileId}/aliases`
|
||||
const response = await http(url)
|
||||
const data = await response.json()
|
||||
if (response.status !== 200) {
|
||||
throw new Error(data.error_description)
|
||||
}
|
||||
return data
|
||||
}
|
||||
|
|
|
@ -13,6 +13,13 @@
|
|||
<div class="avatar-group">
|
||||
<avatar :profile="profile"></avatar>
|
||||
<div class="badges">
|
||||
<div
|
||||
class="badge"
|
||||
v-if="aliases.length > 0"
|
||||
:title="aliases.map(profile => '@' + profile.acct).join(', ')"
|
||||
>
|
||||
Alias
|
||||
</div>
|
||||
<div class="badge" v-if="isFollowedBy()">Follows you</div>
|
||||
<div class="badge" v-if="isSubscriptionValid()">Subscription</div>
|
||||
<div class="badge" v-if="isSubscriber()">Subscriber</div>
|
||||
|
@ -257,6 +264,7 @@ import {
|
|||
} from "@/api/relationships"
|
||||
import { getReceivedSubscriptions } from "@/api/subscriptions-common"
|
||||
import {
|
||||
getAliases,
|
||||
getProfile,
|
||||
lookupProfile,
|
||||
Permissions,
|
||||
|
@ -288,6 +296,7 @@ const { instance, getActorAddress } = $(useInstanceInfo())
|
|||
|
||||
let profile = $ref<ProfileWrapper | null>(null)
|
||||
let relationship = $ref<Relationship | null>(null)
|
||||
let aliases = $ref<Profile[]>([])
|
||||
|
||||
let profileMenuVisible = $ref(false)
|
||||
|
||||
|
@ -327,6 +336,9 @@ onMounted(async () => {
|
|||
profile.id,
|
||||
)
|
||||
}
|
||||
if (profile.identity_proofs.length > 0) {
|
||||
aliases = await getAliases(profile.id)
|
||||
}
|
||||
await switchTab("posts")
|
||||
isLoading = false
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue