kopia lustrzana https://github.com/elk-zone/elk
chore: migrate to new masto.js API
rodzic
3919382302
commit
b0269c4366
|
@ -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\/?/, '')
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ export function useNotifications() {
|
|||
processNotifications(stream, id)
|
||||
|
||||
const position = await client.value.v1.markers.fetch({ timeline: ['notifications'] })
|
||||
const paginator = client.value.v1.notifications.list({ limit: 30 })
|
||||
const paginator = client.value.v1.notifications.list({ limit: 30 }).values()
|
||||
|
||||
do {
|
||||
const result = await paginator.next()
|
||||
|
|
|
@ -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[]>([])
|
||||
|
|
|
@ -14,6 +14,7 @@ import { currentCustomEmojis, updateCustomEmojis } from '~/composables/emojis'
|
|||
export type { Emoji }
|
||||
|
||||
export type CustomEmoji = (mastodon.v1.CustomEmoji & { custom: true })
|
||||
|
||||
export function isCustomEmoji(emoji: CustomEmoji | Emoji): emoji is CustomEmoji {
|
||||
return !!(emoji as CustomEmoji).custom
|
||||
}
|
||||
|
@ -27,7 +28,12 @@ export const TiptapMentionSuggestion: Partial<SuggestionOptions> = import.meta.s
|
|||
if (query.length === 0)
|
||||
return []
|
||||
|
||||
const paginator = useMastoClient().v2.search.list({ q: query, type: 'accounts', limit: 25, resolve: true })
|
||||
const paginator = useMastoClient().v2.search.list({
|
||||
q: query,
|
||||
type: 'accounts',
|
||||
limit: 25,
|
||||
resolve: true,
|
||||
}).values()
|
||||
return (await paginator.next()).value?.accounts ?? []
|
||||
},
|
||||
render: createSuggestionRenderer(TiptapMentionList),
|
||||
|
@ -46,7 +52,7 @@ export const TiptapHashtagSuggestion: Partial<SuggestionOptions> = {
|
|||
limit: 25,
|
||||
resolve: false,
|
||||
excludeUnreviewed: true,
|
||||
})
|
||||
}).values()
|
||||
return (await paginator.next()).value?.hashtags ?? []
|
||||
},
|
||||
render: createSuggestionRenderer(TiptapHashtagList),
|
||||
|
|
|
@ -43,7 +43,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 paginator = masto.client.value.v2.search.list({ q: `https:/${to.fullPath}`, resolve: true, limit: 1 }).values()
|
||||
const { accounts, statuses } = (await paginator.next()).value ?? { accounts: [], statuses: [] }
|
||||
|
||||
if (statuses[0])
|
||||
|
|
Ładowanie…
Reference in New Issue