From b7f32be512ceed536327f8a1c3da6f3d8fc98e75 Mon Sep 17 00:00:00 2001 From: kabo2468 <28654659+kabo2468@users.noreply.github.com> Date: Thu, 17 Nov 2022 09:34:23 +0900 Subject: [PATCH] server: don't nyaize quoted lines Co-authored-by: syuilo Changelog: Changed --- packages/backend/src/models/repositories/note.ts | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/packages/backend/src/models/repositories/note.ts b/packages/backend/src/models/repositories/note.ts index 6e5da24fd..03874d358 100644 --- a/packages/backend/src/models/repositories/note.ts +++ b/packages/backend/src/models/repositories/note.ts @@ -216,12 +216,20 @@ export const NoteRepository = db.getRepository(Note).extend({ if (packed.user.isCat && packed.text) { const tokens = packed.text ? mfm.parse(packed.text) : []; - mfm.inspect(tokens, node => { + function nyaizeNode(node: mfm.Node) { + if (node.type === 'quote') return; if (node.type === 'text') { - // TODO: quoteなtextはskip node.props.text = nyaize(node.props.text); } - }); + if (node.children) { + for (const child of node.children) { + nyaizeNode(child); + } + } + } + for (const node of tokens) { + nyaizeNode(node); + } packed.text = mfm.toString(tokens); }