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

@ -2,7 +2,7 @@
* @vitest-environment jsdom
*/
/* eslint-disable vue/one-component-per-file */
import type { Emoji } from 'masto'
import type { mastodon } from 'masto'
import { describe, expect, it, vi } from 'vitest'
import { renderToString } from 'vue/server-renderer'
import { format } from 'prettier'
@ -54,7 +54,7 @@ describe('content-rich', () => {
})
})
async function render(content: string, emojis?: Record<string, Emoji>) {
async function render(content: string, emojis?: Record<string, mastodon.v1.CustomEmoji>) {
const vnode = contentToVNode(content, { emojis })
const html = (await renderToString(vnode))
.replace(/<!--[\[\]]-->/g, '')

View file

@ -1,7 +1,7 @@
/**
* @vitest-environment jsdom
*/
import type { Emoji } from 'masto'
import type { mastodon } from 'masto'
import { describe, expect, it } from 'vitest'
import { format } from 'prettier'
import { render as renderTree } from 'ultrahtml'
@ -66,7 +66,7 @@ describe('html-parse', () => {
})
})
async function render(input: string, emojis?: Record<string, Emoji>) {
async function render(input: string, emojis?: Record<string, mastodon.v1.CustomEmoji>) {
const tree = parseMastodonHTML(input, { emojis })
const html = await renderTree(tree)
let formatted = ''

View file

@ -1,18 +1,18 @@
/**
* @vitest-environment jsdom
*/
import type { Status } from 'masto'
import type { mastodon } from 'masto'
import { describe, expect, it } from 'vitest'
import { reorderedTimeline } from '~/composables/timeline'
function status(id: string): Status {
return { id } as Status
function status(id: string): mastodon.v1.Status {
return { id } as mastodon.v1.Status
}
function reply(id: string, s: Status) {
return { id, inReplyToId: s.id } as Status
function reply(id: string, s: mastodon.v1.Status) {
return { id, inReplyToId: s.id } as mastodon.v1.Status
}
function reblog(id: string, s: Status) {
return { id, reblog: s } as Status
function reblog(id: string, s: mastodon.v1.Status) {
return { id, reblog: s } as mastodon.v1.Status
}
const p_a1 = status('p_a1')