forked from FoundKeyGang/FoundKey
server: don't nyaize quoted lines
Co-authored-by: syuilo <Syuilotan@yahoo.co.jp> Changelog: Changed
This commit is contained in:
parent
3deec7d30a
commit
b7f32be512
1 changed files with 11 additions and 3 deletions
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue