refactor: sync masto (#1121)
This commit is contained in:
parent
eb1f769e32
commit
4422a57f49
81 changed files with 397 additions and 367 deletions
|
@ -39,7 +39,7 @@ const toggleTranslation = async () => {
|
|||
isLoading.translation = false
|
||||
}
|
||||
|
||||
const masto = useMasto()
|
||||
const { client } = $(useMasto())
|
||||
|
||||
const getPermalinkUrl = (status: mastodon.v1.Status) => {
|
||||
const url = getStatusPermalinkRoute(status)
|
||||
|
@ -70,7 +70,7 @@ const deleteStatus = async () => {
|
|||
return
|
||||
|
||||
removeCachedStatus(status.id)
|
||||
await masto.v1.statuses.remove(status.id)
|
||||
await client.v1.statuses.remove(status.id)
|
||||
|
||||
if (route.name === 'status')
|
||||
router.back()
|
||||
|
@ -88,7 +88,7 @@ const deleteAndRedraft = async () => {
|
|||
}
|
||||
|
||||
removeCachedStatus(status.id)
|
||||
await masto.v1.statuses.remove(status.id)
|
||||
await client.v1.statuses.remove(status.id)
|
||||
await openPublishDialog('dialog', await getDraftFromStatus(status), true)
|
||||
|
||||
// Go to the new status, if the page is the old status
|
||||
|
@ -214,7 +214,7 @@ const showFavoritedAndBoostedBy = () => {
|
|||
@click="toggleTranslation"
|
||||
/>
|
||||
|
||||
<template v-if="isMastoInitialised && currentUser">
|
||||
<template v-if="isHydrated && currentUser">
|
||||
<template v-if="isAuthor">
|
||||
<CommonDropdownItem
|
||||
:text="status.pinned ? $t('menu.unpin_on_profile') : $t('menu.pin_on_profile')"
|
||||
|
|
|
@ -3,8 +3,10 @@ import { favouritedBoostedByStatusId } from '~/composables/dialog'
|
|||
|
||||
const type = ref<'favourited-by' | 'boosted-by'>('favourited-by')
|
||||
|
||||
const { client } = $(useMasto())
|
||||
|
||||
function load() {
|
||||
return useMasto().v1.statuses[type.value === 'favourited-by' ? 'listFavouritedBy' : 'listRebloggedBy'](favouritedBoostedByStatusId.value!)
|
||||
return client.v1.statuses[type.value === 'favourited-by' ? 'listFavouritedBy' : 'listRebloggedBy'](favouritedBoostedByStatusId.value!)
|
||||
}
|
||||
|
||||
const paginator = $computed(() => load())
|
||||
|
|
|
@ -15,7 +15,8 @@ const expiredTimeAgo = useTimeAgo(poll.expiresAt!, timeAgoOptions)
|
|||
const expiredTimeFormatted = useFormattedDateTime(poll.expiresAt!)
|
||||
const { formatPercentage } = useHumanReadableNumber()
|
||||
|
||||
const masto = useMasto()
|
||||
const { client } = $(useMasto())
|
||||
|
||||
async function vote(e: Event) {
|
||||
const formData = new FormData(e.target as HTMLFormElement)
|
||||
const choices = formData.getAll('choices') as string[]
|
||||
|
@ -30,7 +31,7 @@ async function vote(e: Event) {
|
|||
poll.votersCount = (poll.votersCount || 0) + 1
|
||||
cacheStatus({ ...status, poll }, undefined, true)
|
||||
|
||||
await masto.v1.polls.vote(poll.id, { choices })
|
||||
await client.v1.polls.vote(poll.id, { choices })
|
||||
}
|
||||
|
||||
const votersCount = $computed(() => poll.votersCount ?? 0)
|
||||
|
|
|
@ -6,7 +6,7 @@ const { status } = defineProps<{
|
|||
status: mastodon.v1.Status
|
||||
}>()
|
||||
|
||||
const paginator = useMasto().v1.statuses.listHistory(status.id)
|
||||
const paginator = useMastoClient().v1.statuses.listHistory(status.id)
|
||||
|
||||
const showHistory = (edit: mastodon.v1.StatusEdit) => {
|
||||
openEditHistoryDialog(edit)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue