2022-11-25 20:39:21 +09:00
|
|
|
<script setup lang="ts">
|
2023-01-08 15:21:09 +09:00
|
|
|
import type { mastodon } from 'masto'
|
2022-11-25 20:39:21 +09:00
|
|
|
|
|
|
|
const { account } = defineProps<{
|
2023-01-08 15:21:09 +09:00
|
|
|
account: mastodon.v1.Account
|
2022-11-29 17:15:05 +09:00
|
|
|
command?: boolean
|
2022-11-25 20:39:21 +09:00
|
|
|
}>()
|
|
|
|
let relationship = $(useRelationship(account))
|
|
|
|
|
2022-11-26 03:24:46 +09:00
|
|
|
const isSelf = $computed(() => currentUser.value?.account.id === account.id)
|
|
|
|
|
2022-12-25 23:04:50 +09:00
|
|
|
const masto = useMasto()
|
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
|
2023-01-08 15:21:09 +09:00
|
|
|
? await masto.v1.accounts.mute(account.id, {
|
2022-11-26 21:58:10 +09:00
|
|
|
// TODO support more options
|
|
|
|
})
|
2023-01-08 15:21:09 +09:00
|
|
|
: await masto.v1.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
|
2023-01-08 15:21:09 +09:00
|
|
|
relationship = await masto.v1.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
|
2023-01-08 15:21:09 +09:00
|
|
|
await masto.v1.domainBlocks[relationship!.domainBlocking ? 'block' : 'unblock'](getServerName(account))
|
2022-11-25 20:39:21 +09:00
|
|
|
}
|
2023-01-08 22:33:25 +09:00
|
|
|
|
|
|
|
const toggleReblogs = async () => {
|
|
|
|
// TODO: Add confirmation
|
|
|
|
|
|
|
|
const showingReblogs = !relationship?.showingReblogs
|
|
|
|
relationship = await masto.v1.accounts.follow(account.id, { reblogs: showingReblogs })
|
|
|
|
}
|
2022-11-25 20:39:21 +09:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
2022-11-29 17:15:05 +09:00
|
|
|
<CommonDropdown :eager-mount="command">
|
2022-11-30 06:24:26 +09:00
|
|
|
<button flex gap-1 items-center w-full rounded op75 hover="op100 text-purple" group aria-label="More actions">
|
2022-11-25 20:39:21 +09:00
|
|
|
<div rounded-5 p2 group-hover="bg-purple/10">
|
|
|
|
<div i-ri:more-2-fill />
|
|
|
|
</div>
|
|
|
|
</button>
|
|
|
|
|
|
|
|
<template #popper>
|
2022-12-05 04:56:33 +09:00
|
|
|
<NuxtLink :to="account.url" external target="_blank">
|
2022-11-29 17:15:05 +09:00
|
|
|
<CommonDropdownItem
|
|
|
|
:text="$t('menu.open_in_original_site')"
|
|
|
|
icon="i-ri:arrow-right-up-line"
|
|
|
|
:command="command"
|
|
|
|
/>
|
2022-11-25 20:39:21 +09:00
|
|
|
</NuxtLink>
|
|
|
|
|
2022-11-29 02:28:40 +09:00
|
|
|
<template v-if="currentUser">
|
|
|
|
<template v-if="!isSelf">
|
2022-11-29 17:15:05 +09:00
|
|
|
<CommonDropdownItem
|
|
|
|
:text="$t('menu.mention_account', [`@${account.acct}`])"
|
|
|
|
icon="i-ri:at-line"
|
|
|
|
:command="command"
|
|
|
|
@click="mentionUser(account)"
|
|
|
|
/>
|
|
|
|
<CommonDropdownItem
|
|
|
|
:text="$t('menu.direct_message_account', [`@${account.acct}`])"
|
|
|
|
icon="i-ri:message-3-line"
|
|
|
|
:command="command"
|
|
|
|
@click="directMessageUser(account)"
|
|
|
|
/>
|
2022-11-26 21:58:10 +09:00
|
|
|
|
2023-01-08 22:33:25 +09:00
|
|
|
<CommonDropdownItem
|
|
|
|
v-if="!relationship?.showingReblogs"
|
|
|
|
icon="i-ri:repeat-line"
|
|
|
|
:text="$t('menu.show_reblogs', [`@${account.acct}`])"
|
|
|
|
:command="command"
|
|
|
|
@click="toggleReblogs"
|
|
|
|
/>
|
|
|
|
<CommonDropdownItem
|
|
|
|
v-else
|
|
|
|
:text="$t('menu.hide_reblogs', [`@${account.acct}`])"
|
|
|
|
icon="i-ri:repeat-line"
|
|
|
|
:command="command"
|
|
|
|
@click="toggleReblogs"
|
|
|
|
/>
|
|
|
|
|
2022-11-29 17:15:05 +09:00
|
|
|
<CommonDropdownItem
|
|
|
|
v-if="!relationship?.muting"
|
|
|
|
:text="$t('menu.mute_account', [`@${account.acct}`])"
|
|
|
|
icon="i-ri:volume-up-fill"
|
|
|
|
:command="command"
|
|
|
|
@click="toggleMute"
|
|
|
|
/>
|
|
|
|
<CommonDropdownItem
|
|
|
|
v-else
|
|
|
|
:text="$t('menu.unmute_account', [`@${account.acct}`])"
|
|
|
|
icon="i-ri:volume-mute-line"
|
|
|
|
:command="command"
|
|
|
|
@click="toggleMute"
|
|
|
|
/>
|
2022-11-29 02:28:40 +09:00
|
|
|
|
2022-11-29 17:15:05 +09:00
|
|
|
<CommonDropdownItem
|
|
|
|
v-if="!relationship?.blocking"
|
|
|
|
:text="$t('menu.block_account', [`@${account.acct}`])"
|
|
|
|
icon="i-ri:forbid-2-line"
|
|
|
|
:command="command"
|
|
|
|
@click="toggleBlockUser"
|
|
|
|
/>
|
|
|
|
<CommonDropdownItem
|
|
|
|
v-else
|
|
|
|
:text="$t('menu.unblock_account', [`@${account.acct}`])"
|
|
|
|
icon="i-ri:checkbox-circle-line"
|
|
|
|
:command="command"
|
|
|
|
@click="toggleBlockUser"
|
|
|
|
/>
|
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"
|
2022-11-29 17:15:05 +09:00
|
|
|
:text="$t('menu.block_domain', [getServerName(account)])"
|
2022-11-29 10:21:03 +09:00
|
|
|
icon="i-ri:shut-down-line"
|
2022-11-29 17:15:05 +09:00
|
|
|
:command="command"
|
2022-11-29 10:21:03 +09:00
|
|
|
@click="toggleBlockDomain"
|
2022-11-29 17:15:05 +09:00
|
|
|
/>
|
|
|
|
<CommonDropdownItem
|
|
|
|
v-else
|
|
|
|
:text="$t('menu.unblock_domain', [getServerName(account)])"
|
|
|
|
icon="i-ri:restart-line"
|
|
|
|
:command="command"
|
|
|
|
@click="toggleBlockDomain"
|
|
|
|
/>
|
2022-11-29 10:21:03 +09:00
|
|
|
</template>
|
2022-11-29 02:28:40 +09:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<template v-else>
|
|
|
|
<NuxtLink to="/pinned">
|
2022-11-29 19:55:28 +09:00
|
|
|
<CommonDropdownItem :text="$t('account.pinned')" icon="i-ri:pushpin-line" :command="command" />
|
2022-11-29 02:28:40 +09:00
|
|
|
</NuxtLink>
|
|
|
|
<NuxtLink to="/favourites">
|
2022-11-29 19:55:28 +09:00
|
|
|
<CommonDropdownItem :text="$t('account.favourites')" icon="i-ri:heart-3-line" :command="command" />
|
2022-11-29 02:28:40 +09:00
|
|
|
</NuxtLink>
|
|
|
|
<NuxtLink to="/mutes">
|
2022-11-29 19:55:28 +09:00
|
|
|
<CommonDropdownItem :text="$t('account.muted_users')" icon="i-ri:volume-mute-line" :command="command" />
|
2022-11-29 02:28:40 +09:00
|
|
|
</NuxtLink>
|
|
|
|
<NuxtLink to="/blocks">
|
2022-11-29 19:55:28 +09:00
|
|
|
<CommonDropdownItem :text="$t('account.blocked_users')" icon="i-ri:forbid-2-line" :command="command" />
|
2022-11-29 02:28:40 +09:00
|
|
|
</NuxtLink>
|
|
|
|
<NuxtLink to="/domain_blocks">
|
2022-11-29 20:26:24 +09:00
|
|
|
<CommonDropdownItem :text="$t('account.blocked_domains')" icon="i-ri:shut-down-line" :command="command" />
|
2022-11-29 02:28:40 +09:00
|
|
|
</NuxtLink>
|
|
|
|
</template>
|
2022-11-26 03:24:46 +09:00
|
|
|
</template>
|
2022-11-25 20:39:21 +09:00
|
|
|
</template>
|
|
|
|
</CommonDropdown>
|
|
|
|
</template>
|