This commit is contained in:
Aevann1 2021-12-24 04:19:42 +02:00
parent a3663b7911
commit c0f15ceeaf

View file

@ -5,13 +5,14 @@ from flask import g
from .markdown import * from .markdown import *
from .sanitize import * from .sanitize import *
from .const import * from .const import *
from mistletoe.html_renderer import HTMLRenderer
def create_comment(text, autojanny=False): def create_comment(text, autojanny=False):
if autojanny: author_id = AUTOJANNY_ID if autojanny: author_id = AUTOJANNY_ID
else: author_id = NOTIFICATIONS_ID else: author_id = NOTIFICATIONS_ID
text = text.replace('r/', 'r\/').replace('u/', 'u\/') text = text.replace('r/', 'r\/').replace('u/', 'u\/')
text_html = sanitize(mistletoe.Document(text)) text_html = sanitize(HTMLRenderer().render(mistletoe.Document(text)))
new_comment = Comment(author_id=author_id, new_comment = Comment(author_id=author_id,
parent_submission=None, parent_submission=None,
distinguish_level=6, distinguish_level=6,