server: don't nyaize quoted lines

Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>
Changelog: Changed
This commit is contained in:
kabo2468 2022-11-17 09:34:23 +09:00 committed by Johann150
parent 3deec7d30a
commit b7f32be512
Signed by untrusted user: Johann150
GPG key ID: 9EE6577A2A06F8F1

View file

@ -216,12 +216,20 @@ export const NoteRepository = db.getRepository(Note).extend({
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.Node) {
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);
} }