Add "Copy profile ID" item to profile menu if current user is admin
This commit is contained in:
parent
14fbce0285
commit
e2c915a256
3 changed files with 27 additions and 0 deletions
|
@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Add "Copy profile ID" item to profile menu if current user is admin.
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- Show better error message if HTTP status code is 413.
|
- Show better error message if HTTP status code is 413.
|
||||||
|
|
|
@ -33,6 +33,7 @@ interface Role {
|
||||||
|
|
||||||
export enum Permissions {
|
export enum Permissions {
|
||||||
CreatePost = "create_post",
|
CreatePost = "create_post",
|
||||||
|
DeleteAnyProfile = "delete_any_profile",
|
||||||
ManageSubscriptionOptions = "manage_subscription_options",
|
ManageSubscriptionOptions = "manage_subscription_options",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -100,6 +100,14 @@
|
||||||
<li v-if="canShowReplies()">
|
<li v-if="canShowReplies()">
|
||||||
<button @click="onFollow(undefined, true)">Show replies</button>
|
<button @click="onFollow(undefined, true)">Show replies</button>
|
||||||
</li>
|
</li>
|
||||||
|
<li v-if="isAdmin()">
|
||||||
|
<button
|
||||||
|
title="Copy profile ID"
|
||||||
|
@click="hideProfileMenu(); copyProfileId()"
|
||||||
|
>
|
||||||
|
Copy profile ID
|
||||||
|
</button>
|
||||||
|
</li>
|
||||||
</menu>
|
</menu>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -575,6 +583,20 @@ function canSubscribe(): boolean {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isAdmin(): boolean {
|
||||||
|
if (!currentUser) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return currentUser.role.permissions.includes(Permissions.DeleteAnyProfile)
|
||||||
|
}
|
||||||
|
|
||||||
|
function copyProfileId(): void {
|
||||||
|
if (!profile) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
navigator.clipboard.writeText(profile.id)
|
||||||
|
}
|
||||||
|
|
||||||
async function loadNextPage(maxId: string) {
|
async function loadNextPage(maxId: string) {
|
||||||
if (!profile) {
|
if (!profile) {
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in a new issue