refactor: upgrade masto 5 (#867)

This commit is contained in:
三咲智子 Kevin Deng 2023-01-08 14:21:09 +08:00 committed by GitHub
parent 39034c5777
commit 5c8f75b9b7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
108 changed files with 438 additions and 445 deletions

View file

@ -1,8 +1,8 @@
<script setup lang="ts">
import type { Status } from 'masto'
import type { mastodon } from 'masto'
const props = defineProps<{
status: Status
status: mastodon.v1.Status
details?: boolean
command?: boolean
}>()
@ -40,21 +40,21 @@ const toggleTranslation = async () => {
const masto = useMasto()
const getPermalinkUrl = (status: Status) => {
const getPermalinkUrl = (status: mastodon.v1.Status) => {
const url = getStatusPermalinkRoute(status)
if (url)
return `${location.origin}/${url}`
return null
}
const copyLink = async (status: Status) => {
const copyLink = async (status: mastodon.v1.Status) => {
const url = getPermalinkUrl(status)
if (url)
await clipboard.copy(url)
}
const { share, isSupported: isShareSupported } = useShare()
const shareLink = async (status: Status) => {
const shareLink = async (status: mastodon.v1.Status) => {
const url = getPermalinkUrl(status)
if (url)
await share({ url })
@ -69,7 +69,7 @@ const deleteStatus = async () => {
return
removeCachedStatus(status.id)
await masto.statuses.remove(status.id)
await masto.v1.statuses.remove(status.id)
if (route.name === 'status')
router.back()
@ -87,7 +87,7 @@ const deleteAndRedraft = async () => {
}
removeCachedStatus(status.id)
await masto.statuses.remove(status.id)
await masto.v1.statuses.remove(status.id)
await openPublishDialog('dialog', await getDraftFromStatus(status), true)
// Go to the new status, if the page is the old status