chore: migrate to masto v7
This commit is contained in:
parent
8b0dca0a59
commit
a586f9ffaf
7 changed files with 9 additions and 9 deletions
|
|
@ -13,7 +13,7 @@ const options = { limit: 30, types: filter ? [filter] : [] }
|
|||
|
||||
// Default limit is 20 notifications, and servers are normally caped to 30
|
||||
const paginator = useMastoClient().v1.notifications.list(options)
|
||||
const stream = useStreaming(client => client.user.notification.subscribe())
|
||||
const stream = useStreaming(client => client.user.subscribe())
|
||||
|
||||
lastAccessedNotificationRoute.value = route.path.replace(/\/notifications\/?/, '')
|
||||
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ export async function fetchAccountByHandle(acct: string): Promise<mastodon.v1.Ac
|
|||
}
|
||||
else {
|
||||
const userAcctDomain = userAcct.includes('@') ? userAcct : `${userAcct}@${domain}`
|
||||
account = (await client.v1.search.fetch({ q: `@${userAcctDomain}`, type: 'accounts' })).accounts[0]
|
||||
account = (await client.v2.search.list({ q: `@${userAcctDomain}`, type: 'accounts' })).accounts[0]
|
||||
}
|
||||
|
||||
if (account.acct && !account.acct.includes('@') && domain)
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ export function useNotifications() {
|
|||
const paginator = client.value.v1.notifications.list({ limit: 30 })
|
||||
|
||||
do {
|
||||
const result = await paginator.next()
|
||||
const result = await paginator.values().next()
|
||||
if (!result.done && result.value.length) {
|
||||
for (const notification of result.value) {
|
||||
if (notification.id === position.notifications.lastReadId)
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ export function useSearch(query: MaybeRefOrGetter<string>, options: UseSearchOpt
|
|||
...resolveUnref(options),
|
||||
resolve: !!currentUser.value,
|
||||
})
|
||||
const nextResults = await paginator.next()
|
||||
const nextResults = await paginator.values().next()
|
||||
|
||||
done.value = !!nextResults.done
|
||||
if (!nextResults.done)
|
||||
|
|
@ -91,7 +91,7 @@ export function useSearch(query: MaybeRefOrGetter<string>, options: UseSearchOpt
|
|||
return
|
||||
|
||||
loading.value = true
|
||||
const nextResults = await paginator.next()
|
||||
const nextResults = await paginator.values().next()
|
||||
loading.value = false
|
||||
|
||||
done.value = !!nextResults.done
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ export function usePaginator<T, P, U = T>(
|
|||
// called `next` method will mutate the internal state of the variable,
|
||||
// and we need its initial state after HMR
|
||||
// so clone it
|
||||
const paginator = _paginator.clone()
|
||||
const paginator = _paginator.values()
|
||||
|
||||
const state = ref<PaginatorState>(isHydrated.value ? 'idle' : 'loading')
|
||||
const items = ref<U[]>([])
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ export const TiptapMentionSuggestion: Partial<SuggestionOptions> = import.meta.s
|
|||
return []
|
||||
|
||||
const paginator = useMastoClient().v2.search.list({ q: query, type: 'accounts', limit: 25, resolve: true })
|
||||
return (await paginator.next()).value?.accounts ?? []
|
||||
return (await paginator.values().next()).value?.accounts ?? []
|
||||
},
|
||||
render: createSuggestionRenderer(TiptapMentionList),
|
||||
}
|
||||
|
|
@ -47,7 +47,7 @@ export const TiptapHashtagSuggestion: Partial<SuggestionOptions> = {
|
|||
resolve: false,
|
||||
excludeUnreviewed: true,
|
||||
})
|
||||
return (await paginator.next()).value?.hashtags ?? []
|
||||
return (await paginator.values().next()).value?.hashtags ?? []
|
||||
},
|
||||
render: createSuggestionRenderer(TiptapHashtagList),
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ export default defineNuxtRouteMiddleware(async (to, from) => {
|
|||
|
||||
// If we're logged in, search for the local id the account or status corresponds to
|
||||
const paginator = masto.client.value.v2.search.list({ q: `https:/${to.fullPath}`, resolve: true, limit: 1 })
|
||||
const { accounts, statuses } = (await paginator.next()).value ?? { accounts: [], statuses: [] }
|
||||
const { accounts, statuses } = (await paginator.values().next()).value ?? { accounts: [], statuses: [] }
|
||||
|
||||
if (statuses[0])
|
||||
return getStatusRoute(statuses[0])
|
||||
|
|
|
|||
Loading…
Reference in a new issue