fix: don't nyaize quoted text

This commit is contained in:
kabo2468 2022-11-17 09:34:23 +09:00 committed by naskya
parent eae2c959d3
commit b717f6d6ff
No known key found for this signature in database
GPG key ID: 164DFF24E2D40139

View file

@ -265,12 +265,22 @@ 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) => {
if (node.type === "text") {
// TODO: quoteなtextはskip
function nyaizeNode(node: mfm.MfmNode) {
if (node.type === "quote")
return;
if (node.type === "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);
}