From 456705a3d583190e271b5ce4af545b2b5b4c69ee 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] =?UTF-8?q?fix:=20=E5=BC=95=E7=94=A8=E5=86=85=E3=81=AE?= =?UTF-8?q?=E6=96=87=E7=AB=A0=E3=82=92nyaize=E3=82=92=E3=81=97=E3=81=AA?= =?UTF-8?q?=E3=81=84=E3=82=88=E3=81=86=E3=81=AB=20(#9141)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix nyaize in quote * Update CHANGELOG.md * for ofのほうが早いらしい * Update NoteEntityService.ts Co-authored-by: syuilo --- CHANGELOG.md | 1 + .../backend/src/core/entities/NoteEntityService.ts | 14 +++++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f1bc0a96f..2c87db855 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ You should also include the user name that made the change. ### Improvements ### Bugfixes +- Server: 引用内の文章がnyaizeされてしまう問題を修正 @kabo2468 - Server: Bug fix for Pinned Users lookup on instance @squidicuzz - Client: インスタンスティッカーのfaviconを読み込む際に偽サイト警告が出ることがあるのを修正 @syuilo diff --git a/packages/backend/src/core/entities/NoteEntityService.ts b/packages/backend/src/core/entities/NoteEntityService.ts index 098f072a5..5605cf8ce 100644 --- a/packages/backend/src/core/entities/NoteEntityService.ts +++ b/packages/backend/src/core/entities/NoteEntityService.ts @@ -329,12 +329,20 @@ export class NoteEntityService implements OnModuleInit { if (packed.user.isCat && packed.text) { const tokens = packed.text ? mfm.parse(packed.text) : []; - mfm.inspect(tokens, node => { + function nyaizeNode(node: mfm.MfmNode) { + 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); }