feat: upgrade to masto.js v6 (#2530)
This commit is contained in:
parent
d8ea685803
commit
6c5bb83ac3
62 changed files with 262 additions and 263 deletions
|
@ -19,7 +19,7 @@ const { client } = $(useMasto())
|
|||
async function unblock() {
|
||||
relationship!.blocking = false
|
||||
try {
|
||||
const newRel = await client.v1.accounts.unblock(account.id)
|
||||
const newRel = await client.v1.accounts.$select(account.id).unblock()
|
||||
Object.assign(relationship!, newRel)
|
||||
}
|
||||
catch (err) {
|
||||
|
@ -32,7 +32,7 @@ async function unblock() {
|
|||
async function unmute() {
|
||||
relationship!.muting = false
|
||||
try {
|
||||
const newRel = await client.v1.accounts.unmute(account.id)
|
||||
const newRel = await client.v1.accounts.$select(account.id).unmute()
|
||||
Object.assign(relationship!, newRel)
|
||||
}
|
||||
catch (err) {
|
||||
|
|
|
@ -12,7 +12,7 @@ async function authorizeFollowRequest() {
|
|||
relationship!.requestedBy = false
|
||||
relationship!.followedBy = true
|
||||
try {
|
||||
const newRel = await client.v1.followRequests.authorize(account.id)
|
||||
const newRel = await client.v1.followRequests.$select(account.id).authorize()
|
||||
Object.assign(relationship!, newRel)
|
||||
}
|
||||
catch (err) {
|
||||
|
@ -25,7 +25,7 @@ async function authorizeFollowRequest() {
|
|||
async function rejectFollowRequest() {
|
||||
relationship!.requestedBy = false
|
||||
try {
|
||||
const newRel = await client.v1.followRequests.reject(account.id)
|
||||
const newRel = await client.v1.followRequests.$select(account.id).reject()
|
||||
Object.assign(relationship!, newRel)
|
||||
}
|
||||
catch (err) {
|
||||
|
|
|
@ -53,7 +53,7 @@ function previewAvatar() {
|
|||
async function toggleNotifications() {
|
||||
relationship!.notifying = !relationship?.notifying
|
||||
try {
|
||||
const newRel = await client.v1.accounts.follow(account.id, { notify: relationship?.notifying })
|
||||
const newRel = await client.v1.accounts.$select(account.id).follow({ notify: relationship?.notifying })
|
||||
Object.assign(relationship!, newRel)
|
||||
}
|
||||
catch {
|
||||
|
@ -97,7 +97,7 @@ async function editNote(event: Event) {
|
|||
if (relationship.note?.trim() === newNote.trim())
|
||||
return
|
||||
|
||||
const newNoteApiResult = await client.v1.accounts.createNote(account.id, { comment: newNote })
|
||||
const newNoteApiResult = await client.v1.accounts.$select(account.id).note.create({ comment: newNote })
|
||||
relationship.note = newNoteApiResult.note
|
||||
personalNoteDraft.value = relationship.note ?? ''
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ async function toggleReblogs() {
|
|||
return
|
||||
|
||||
const showingReblogs = !relationship?.showingReblogs
|
||||
relationship = await client.v1.accounts.follow(account.id, { reblogs: showingReblogs })
|
||||
relationship = await client.v1.accounts.$select(account.id).follow({ reblogs: showingReblogs })
|
||||
}
|
||||
|
||||
async function addUserNote() {
|
||||
|
@ -44,7 +44,7 @@ async function removeUserNote() {
|
|||
if (!relationship!.note || relationship!.note.length === 0)
|
||||
return
|
||||
|
||||
const newNote = await client.v1.accounts.createNote(account.id, { comment: '' })
|
||||
const newNote = await client.v1.accounts.$select(account.id).note.create({ comment: '' })
|
||||
relationship!.note = newNote.note
|
||||
emit('removeNote')
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<script setup lang="ts">
|
||||
import type { Paginator, mastodon } from 'masto'
|
||||
import type { mastodon } from 'masto'
|
||||
|
||||
const { paginator, account, context } = defineProps<{
|
||||
paginator: Paginator<mastodon.v1.Account[], mastodon.DefaultPaginationParams>
|
||||
paginator: mastodon.Paginator<mastodon.v1.Account[], mastodon.DefaultPaginationParams | undefined>
|
||||
context?: 'following' | 'followers'
|
||||
account?: mastodon.v1.Account
|
||||
relationshipContext?: 'followedBy' | 'following'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue