fix: 引用内の文章をnyaizeをしないように (#9141)

* fix nyaize in quote

* Update CHANGELOG.md

* for ofのほうが早いらしい

* Update NoteEntityService.ts

Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>
This commit is contained in:
kabo2468 2022-11-17 09:34:23 +09:00 committed by GitHub
parent 746fac0dfe
commit 456705a3d5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 3 deletions

View file

@ -20,6 +20,7 @@ You should also include the user name that made the change.
### Improvements ### Improvements
### Bugfixes ### Bugfixes
- Server: 引用内の文章がnyaizeされてしまう問題を修正 @kabo2468
- Server: Bug fix for Pinned Users lookup on instance @squidicuzz - Server: Bug fix for Pinned Users lookup on instance @squidicuzz
- Client: インスタンスティッカーのfaviconを読み込む際に偽サイト警告が出ることがあるのを修正 @syuilo - Client: インスタンスティッカーのfaviconを読み込む際に偽サイト警告が出ることがあるのを修正 @syuilo

View file

@ -329,12 +329,20 @@ export class NoteEntityService implements OnModuleInit {
if (packed.user.isCat && packed.text) { if (packed.user.isCat && packed.text) {
const tokens = packed.text ? mfm.parse(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') { if (node.type === 'text') {
// TODO: quoteなtextはskip
node.props.text = nyaize(node.props.text); 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); packed.text = mfm.toString(tokens);
} }