fix: Hide unmute option when the user is blocked

This commit is contained in:
Daniel Hernández 2023-02-09 13:46:32 -04:00
parent 135860cc68
commit 569136b87c
No known key found for this signature in database
GPG key ID: 1FE6E4A6C61D7B31
3 changed files with 7 additions and 4 deletions

View file

@ -26,7 +26,7 @@
<span>{{ item.text }}</span>
<span v-if="item.indicate" class="indicator"><i class="ph-circle-fill"></i></span>
</a>
<button v-else-if="item.type === 'user'" :tabindex="i" class="_button item" :class="{ active: item.active }" :disabled="item.active" @click="clicked(item.action, $event)" @mouseenter.passive="onItemMouseEnter(item)" @mouseleave.passive="onItemMouseLeave(item)">
<button v-else-if="item.type === 'user' && !items.hidden" :tabindex="i" class="_button item" :class="{ active: item.active }" :disabled="item.active" @click="clicked(item.action, $event)" @mouseenter.passive="onItemMouseEnter(item)" @mouseleave.passive="onItemMouseLeave(item)">
<MkAvatar :user="item.user" class="avatar"/><MkUserName :user="item.user"/>
<span v-if="item.indicate" class="indicator"><i class="ph-circle-fill"></i></span>
</button>
@ -38,7 +38,7 @@
<span>{{ item.text }}</span>
<span class="caret"><i class="ph-caret-right-bold ph-lg ph-fw ph-lg"></i></span>
</button>
<button v-else :tabindex="i" class="_button item" :class="{ danger: item.danger, active: item.active }" :disabled="item.active" @click="clicked(item.action, $event)" @mouseenter.passive="onItemMouseEnter(item)" @mouseleave.passive="onItemMouseLeave(item)">
<button v-else-if="!item.hidden" :tabindex="i" class="_button item" :class="{ danger: item.danger, active: item.active }" :disabled="item.active" @click="clicked(item.action, $event)" @mouseenter.passive="onItemMouseEnter(item)" @mouseleave.passive="onItemMouseLeave(item)">
<i v-if="item.icon" class="ph-fw ph-lg" :class="item.icon"></i>
<MkAvatar v-if="item.avatar" :user="item.avatar" class="avatar"/>
<span>{{ item.text }}</span>

View file

@ -128,7 +128,7 @@ export function getUserMenu(user, router: Router = mainRouter) {
await os.apiWithDialog(user.isBlocking ? "blocking/delete" : "blocking/create", {
userId: user.id,
})
user.isBlocking = !user.isBlocking;
user.isBlocking = !user.isBlocking;
await os.api(user.isBlocking ? "mute/create" : "mute/delete", {
userId: user.id,
})
@ -136,7 +136,7 @@ export function getUserMenu(user, router: Router = mainRouter) {
if (user.isBlocking) {
await os.api('following/delete', {
userId: user.id,
});
});
user.isFollowing = false
}
}
@ -261,6 +261,7 @@ export function getUserMenu(user, router: Router = mainRouter) {
{
icon: user.isMuted ? "ph-eye-bold ph-lg" : "ph-eye-slash-bold ph-lg",
text: user.isMuted ? i18n.ts.unmute : i18n.ts.mute,
hidden: user.isBlocking === true,
action: toggleMute,
},
{

View file

@ -28,6 +28,7 @@ export type MenuUser = {
user: Misskey.entities.User;
active?: boolean;
indicate?: boolean;
hidden?: boolean;
action: MenuAction;
};
export type MenuSwitch = {
@ -43,6 +44,7 @@ export type MenuButton = {
indicate?: boolean;
danger?: boolean;
active?: boolean;
hidden?: boolean;
avatar?: Misskey.entities.User;
action: MenuAction;
};