2022-11-25 20:39:21 +09:00
|
|
|
<script setup lang="ts">
|
|
|
|
import type { Account } from 'masto'
|
|
|
|
|
|
|
|
const { account } = defineProps<{
|
|
|
|
account: Account
|
|
|
|
}>()
|
|
|
|
let relationship = $(useRelationship(account))
|
|
|
|
|
2022-11-26 03:24:46 +09:00
|
|
|
const isSelf = $computed(() => currentUser.value?.account.id === account.id)
|
|
|
|
|
2022-11-26 21:58:10 +09:00
|
|
|
const toggleMute = async () => {
|
2022-11-25 20:39:21 +09:00
|
|
|
// TODO: Add confirmation
|
|
|
|
|
2022-11-26 21:58:10 +09:00
|
|
|
relationship!.muting = !relationship!.muting
|
|
|
|
relationship = relationship!.muting
|
2022-11-27 00:42:58 +09:00
|
|
|
? await useMasto().accounts.mute(account.id, {
|
2022-11-26 21:58:10 +09:00
|
|
|
// TODO support more options
|
|
|
|
})
|
2022-11-27 00:42:58 +09:00
|
|
|
: await useMasto().accounts.unmute(account.id)
|
2022-11-25 20:39:21 +09:00
|
|
|
}
|
|
|
|
|
2022-11-26 21:58:10 +09:00
|
|
|
const toggleBlockUser = async () => {
|
2022-11-25 20:39:21 +09:00
|
|
|
// TODO: Add confirmation
|
|
|
|
|
2022-11-26 21:58:10 +09:00
|
|
|
relationship!.blocking = !relationship!.blocking
|
2022-11-27 00:42:58 +09:00
|
|
|
relationship = await useMasto().accounts[relationship!.blocking ? 'block' : 'unblock'](account.id)
|
2022-11-25 20:39:21 +09:00
|
|
|
}
|
|
|
|
|
2022-11-26 21:58:10 +09:00
|
|
|
const toggleBlockDomain = async () => {
|
2022-11-25 20:39:21 +09:00
|
|
|
// TODO: Add confirmation
|
|
|
|
|
2022-11-26 21:58:10 +09:00
|
|
|
relationship!.domainBlocking = !relationship!.domainBlocking
|
2022-11-27 00:42:58 +09:00
|
|
|
await useMasto().domainBlocks[relationship!.domainBlocking ? 'block' : 'unblock'](getServerName(account))
|
2022-11-25 20:39:21 +09:00
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
|
|
|
<CommonDropdown>
|
|
|
|
<button flex gap-1 items-center w-full rounded op75 hover="op100 text-purple" group>
|
|
|
|
<div rounded-5 p2 group-hover="bg-purple/10">
|
|
|
|
<div i-ri:more-2-fill />
|
|
|
|
</div>
|
|
|
|
</button>
|
|
|
|
|
|
|
|
<template #popper>
|
|
|
|
<NuxtLink :to="account.url" target="_blank">
|
|
|
|
<CommonDropdownItem icon="i-ri:arrow-right-up-line">
|
2022-11-29 15:57:32 +09:00
|
|
|
{{ $t('menu.open_in_original_site') }}
|
2022-11-25 20:39:21 +09:00
|
|
|
</CommonDropdownItem>
|
|
|
|
</NuxtLink>
|
|
|
|
|
2022-11-29 02:28:40 +09:00
|
|
|
<template v-if="currentUser">
|
|
|
|
<template v-if="!isSelf">
|
|
|
|
<CommonDropdownItem icon="i-ri:at-line" @click="mentionUser(account)">
|
2022-11-29 16:18:28 +09:00
|
|
|
{{ $t('menu.mention_account', [`@${account.acct}`]) }}
|
2022-11-29 02:28:40 +09:00
|
|
|
</CommonDropdownItem>
|
|
|
|
<CommonDropdownItem icon="i-ri:message-3-line" @click="directMessageUser(account)">
|
2022-11-29 16:18:28 +09:00
|
|
|
{{ $t('menu.direct_message_account', [`@${account.acct}`]) }}
|
2022-11-29 02:28:40 +09:00
|
|
|
</CommonDropdownItem>
|
2022-11-26 21:58:10 +09:00
|
|
|
|
2022-11-29 02:28:40 +09:00
|
|
|
<CommonDropdownItem v-if="!relationship?.muting" icon="i-ri:volume-up-fill" @click="toggleMute">
|
2022-11-29 16:18:28 +09:00
|
|
|
{{ $t('menu.mute_account', [`@${account.acct}`]) }}
|
2022-11-26 21:58:10 +09:00
|
|
|
</CommonDropdownItem>
|
2022-11-29 02:28:40 +09:00
|
|
|
<CommonDropdownItem v-else icon="i-ri:volume-mute-line" @click="toggleMute">
|
2022-11-29 16:18:28 +09:00
|
|
|
{{ $t('menu.unmute_account', [`@${account.acct}`]) }}
|
2022-11-26 21:58:10 +09:00
|
|
|
</CommonDropdownItem>
|
2022-11-29 02:28:40 +09:00
|
|
|
|
|
|
|
<CommonDropdownItem v-if="!relationship?.blocking" icon="i-ri:forbid-2-line" @click="toggleBlockUser">
|
2022-11-29 16:18:28 +09:00
|
|
|
{{ $t('menu.block_account', [`@${account.acct}`]) }}
|
2022-11-29 02:28:40 +09:00
|
|
|
</CommonDropdownItem>
|
|
|
|
<CommonDropdownItem v-else icon="i-ri:checkbox-circle-line" @click="toggleBlockUser">
|
2022-11-29 16:18:28 +09:00
|
|
|
{{ $t('menu.unblock_account', [`@${account.acct}`]) }}
|
2022-11-26 21:58:10 +09:00
|
|
|
</CommonDropdownItem>
|
2022-11-29 02:28:40 +09:00
|
|
|
|
2022-11-29 10:21:03 +09:00
|
|
|
<template v-if="getServerName(account) !== currentServer">
|
|
|
|
<CommonDropdownItem
|
|
|
|
v-if="!relationship?.domainBlocking"
|
|
|
|
icon="i-ri:shut-down-line"
|
|
|
|
@click="toggleBlockDomain"
|
|
|
|
>
|
2022-11-29 15:57:32 +09:00
|
|
|
{{ $t('menu.block_domain', [getServerName(account)]) }}
|
2022-11-29 10:21:03 +09:00
|
|
|
</CommonDropdownItem>
|
|
|
|
<CommonDropdownItem v-else icon="i-ri:restart-line" @click="toggleBlockDomain">
|
2022-11-29 15:57:32 +09:00
|
|
|
{{ $t('menu.unblock_domain', [getServerName(account)]) }}
|
2022-11-29 10:21:03 +09:00
|
|
|
</CommonDropdownItem>
|
|
|
|
</template>
|
2022-11-29 02:28:40 +09:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<template v-else>
|
|
|
|
<NuxtLink to="/pinned">
|
|
|
|
<CommonDropdownItem icon="i-ri:pushpin-line">
|
|
|
|
Pinned
|
|
|
|
</CommonDropdownItem>
|
|
|
|
</NuxtLink>
|
|
|
|
<NuxtLink to="/favourites">
|
|
|
|
<CommonDropdownItem icon="i-ri:heart-3-line">
|
|
|
|
Favourites
|
|
|
|
</CommonDropdownItem>
|
|
|
|
</NuxtLink>
|
|
|
|
<NuxtLink to="/mutes">
|
|
|
|
<CommonDropdownItem icon="i-ri:volume-mute-line">
|
|
|
|
Muted users
|
|
|
|
</CommonDropdownItem>
|
|
|
|
</NuxtLink>
|
|
|
|
<NuxtLink to="/blocks">
|
|
|
|
<CommonDropdownItem icon="i-ri:forbid-2-line">
|
|
|
|
Blocked users
|
|
|
|
</CommonDropdownItem>
|
|
|
|
</NuxtLink>
|
|
|
|
<NuxtLink to="/domain_blocks">
|
|
|
|
<CommonDropdownItem icon="i-ri:shut-down-line">
|
|
|
|
Blocked domains
|
|
|
|
</CommonDropdownItem>
|
|
|
|
</NuxtLink>
|
|
|
|
</template>
|
2022-11-26 03:24:46 +09:00
|
|
|
</template>
|
2022-11-25 20:39:21 +09:00
|
|
|
</template>
|
|
|
|
</CommonDropdown>
|
|
|
|
</template>
|