diff --git a/components/account/AccountFollowButton.vue b/components/account/AccountFollowButton.vue index 13b020c2..bc4e496a 100644 --- a/components/account/AccountFollowButton.vue +++ b/components/account/AccountFollowButton.vue @@ -6,11 +6,17 @@ const { account } = defineProps<{ }>() const isSelf = $computed(() => currentUser.value?.account.id === account.id) -const relationship = $(useRelationship(account)) +let relationship = $(useRelationship(account)) async function toggleFollow() { relationship!.following = !relationship!.following - await masto.accounts[relationship!.following ? 'follow' : 'unfollow'](account.id) + try { + relationship = await masto.accounts[relationship!.following ? 'follow' : 'unfollow'](account.id) + } + catch { + // TODO error handling + relationship!.following = !relationship!.following + } } diff --git a/components/account/AccountMoreButton.vue b/components/account/AccountMoreButton.vue index 5bda60c4..62590c8f 100644 --- a/components/account/AccountMoreButton.vue +++ b/components/account/AccountMoreButton.vue @@ -8,34 +8,29 @@ let relationship = $(useRelationship(account)) const isSelf = $computed(() => currentUser.value?.account.id === account.id) -const mute = async () => { +const toggleMute = async () => { // TODO: Add confirmation - relationship!.muting = true - relationship = await masto.accounts.mute(account.id, { - // TODO support more options - }) + relationship!.muting = !relationship!.muting + relationship = relationship!.muting + ? await masto.accounts.mute(account.id, { + // TODO support more options + }) + : await masto.accounts.unmute(account.id) } -const unmute = async () => { +const toggleBlockUser = async () => { // TODO: Add confirmation - relationship!.muting = false - relationship = await masto.accounts.unmute(account.id) + relationship!.blocking = !relationship!.blocking + relationship = await masto.accounts[relationship!.blocking ? 'block' : 'unblock'](account.id) } -const block = async () => { +const toggleBlockDomain = async () => { // TODO: Add confirmation - relationship!.blocking = true - relationship = await masto.accounts.block(account.id) -} - -const unblock = async () => { - // TODO: Add confirmation - - relationship!.blocking = false - relationship = await masto.accounts.unblock(account.id) + relationship!.domainBlocking = !relationship!.domainBlocking + await masto.domainBlocks[relationship!.domainBlocking ? 'block' : 'unblock'](getServerName(account)) } @@ -62,19 +57,58 @@ const unblock = async () => { Direct message @{{ account.acct }} - + Mute @{{ account.acct }} - + Unmute @{{ account.acct }} - + Block @{{ account.acct }} - + Unblock @{{ account.acct }} + + + Block domain {{ getServerName(account) }} + + + Unblock domain {{ getServerName(account) }} + + + + diff --git a/components/common/dropdown/DropdownItem.vue b/components/common/dropdown/DropdownItem.vue index 7dc93b7e..6fcd81c2 100644 --- a/components/common/dropdown/DropdownItem.vue +++ b/components/common/dropdown/DropdownItem.vue @@ -19,6 +19,7 @@ const handleClick = (evt: MouseEvent) => { diff --git a/components/main/MainContent.vue b/components/main/MainContent.vue index c164f2ee..1b3de65e 100644 --- a/components/main/MainContent.vue +++ b/components/main/MainContent.vue @@ -1,3 +1,9 @@ + +