From 135860cc68380e5a3827a2c009cf9b3083169f46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Hern=C3=A1ndez?= Date: Thu, 9 Feb 2023 13:17:14 -0400 Subject: [PATCH 1/4] feat: Mute and unfollow when blocking a user --- packages/client/src/scripts/get-user-menu.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/packages/client/src/scripts/get-user-menu.ts b/packages/client/src/scripts/get-user-menu.ts index 9e357e92c..00a271c3c 100644 --- a/packages/client/src/scripts/get-user-menu.ts +++ b/packages/client/src/scripts/get-user-menu.ts @@ -125,11 +125,20 @@ export function getUserMenu(user, router: Router = mainRouter) { ) return; - os.apiWithDialog(user.isBlocking ? "blocking/delete" : "blocking/create", { + await os.apiWithDialog(user.isBlocking ? "blocking/delete" : "blocking/create", { userId: user.id, - }).then(() => { + }) user.isBlocking = !user.isBlocking; + await os.api(user.isBlocking ? "mute/create" : "mute/delete", { + userId: user.id, + }) + user.isMuted = user.isBlocking; + if (user.isBlocking) { + await os.api('following/delete', { + userId: user.id, }); + user.isFollowing = false + } } async function toggleSilence() { From 569136b87c34cb6fe5fbd6e3977d0d2d34726860 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Hern=C3=A1ndez?= Date: Thu, 9 Feb 2023 13:46:32 -0400 Subject: [PATCH 2/4] fix: Hide unmute option when the user is blocked --- packages/client/src/components/MkMenu.vue | 4 ++-- packages/client/src/scripts/get-user-menu.ts | 5 +++-- packages/client/src/types/menu.ts | 2 ++ 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/packages/client/src/components/MkMenu.vue b/packages/client/src/components/MkMenu.vue index 78c1ff223..c07185377 100644 --- a/packages/client/src/components/MkMenu.vue +++ b/packages/client/src/components/MkMenu.vue @@ -26,7 +26,7 @@ {{ item.text }} - @@ -38,7 +38,7 @@ {{ item.text }} -