From 9e309f740e5bb4fe21bbd5f1a1077c66248a609f Mon Sep 17 00:00:00 2001 From: Johann150 Date: Sun, 28 Aug 2022 19:48:00 +0200 Subject: [PATCH] fix: make toHtml async --- packages/backend/src/mfm/to-html.ts | 2 +- packages/backend/src/remote/activitypub/renderer/note.ts | 2 +- packages/backend/src/remote/activitypub/renderer/person.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/backend/src/mfm/to-html.ts b/packages/backend/src/mfm/to-html.ts index f86256a61..af399e81f 100644 --- a/packages/backend/src/mfm/to-html.ts +++ b/packages/backend/src/mfm/to-html.ts @@ -8,7 +8,7 @@ import { intersperse } from '@/prelude/array.js'; // Transforms MFM to HTML, given the MFM text and a list of user IDs that are // mentioned in the text. If the list of mentions is not given, all mentions // from the text will be extracted. -export function toHtml(mfmText: string, mentions?: string[]): string | null { +export async function toHtml(mfmText: string, mentions?: string[]): string | null { const nodes = mfm.parse(mfmText); if (nodes == null) { return null; diff --git a/packages/backend/src/remote/activitypub/renderer/note.ts b/packages/backend/src/remote/activitypub/renderer/note.ts index 640819458..f79005f0e 100644 --- a/packages/backend/src/remote/activitypub/renderer/note.ts +++ b/packages/backend/src/remote/activitypub/renderer/note.ts @@ -100,7 +100,7 @@ export default async function renderNote(note: Note, dive = true, isTalk = false const summary = note.cw === '' ? String.fromCharCode(0x200B) : note.cw; - const content = toHtml(apText, note.mentions); + const content = await toHtml(apText, note.mentions); const emojis = await getEmojis(note.emojis); const apemojis = emojis.map(emoji => renderEmoji(emoji)); diff --git a/packages/backend/src/remote/activitypub/renderer/person.ts b/packages/backend/src/remote/activitypub/renderer/person.ts index d59beef07..7de957882 100644 --- a/packages/backend/src/remote/activitypub/renderer/person.ts +++ b/packages/backend/src/remote/activitypub/renderer/person.ts @@ -65,7 +65,7 @@ export async function renderPerson(user: ILocalUser) { url: `${config.url}/@${user.username}`, preferredUsername: user.username, name: user.name, - summary: profile.description ? toHtml(profile.description) : null, + summary: profile.description ? await toHtml(profile.description) : null, icon: avatar ? renderImage(avatar) : null, image: banner ? renderImage(banner) : null, tag,