summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkabo2468 <28654659+kabo2468@users.noreply.github.com>2022-11-17 09:34:23 +0900
committerGitHub <noreply@github.com>2022-11-17 09:34:23 +0900
commit456705a3d583190e271b5ce4af545b2b5b4c69ee (patch)
tree915f16b4ec3281ced5d34a228e6529ac15edea4d
parentfix typo on CleanRemoteFilesProcessorService (#9171) (diff)
downloadsharkey-456705a3d583190e271b5ce4af545b2b5b4c69ee.tar.gz
sharkey-456705a3d583190e271b5ce4af545b2b5b4c69ee.tar.bz2
sharkey-456705a3d583190e271b5ce4af545b2b5b4c69ee.zip
fix: 引用内の文章をnyaizeをしないように (#9141)
* fix nyaize in quote * Update CHANGELOG.md * for ofのほうが早いらしい * Update NoteEntityService.ts Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>
-rw-r--r--CHANGELOG.md1
-rw-r--r--packages/backend/src/core/entities/NoteEntityService.ts14
2 files changed, 12 insertions, 3 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index f1bc0a96fd..2c87db8558 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 098f072a51..5605cf8ce6 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);
}