diff --git a/files/classes/comment.py b/files/classes/comment.py index 8cc74a0913..d299cc3bbb 100644 --- a/files/classes/comment.py +++ b/files/classes/comment.py @@ -392,7 +392,15 @@ class Comment(Base): @lazy def ordered_flags(self): return self.flags.order_by(CommentFlag.id).all() - + def options_html(self, v): + html = "" + for o in self.options: + html += f'
' + return html class Notification(Base): diff --git a/files/routes/comments.py b/files/routes/comments.py index b0f6131d98..c0144f45a6 100644 --- a/files/routes/comments.py +++ b/files/routes/comments.py @@ -646,6 +646,18 @@ def edit_comment(cid, v): body = body.replace('I ', f'@{v.username} ') body = censor_slurs2(body).upper().replace(' ME ', f' @{v.username} ') + if not c.options: + for i in re.finditer('\s*\$\$([^\$\n]+)\$\$\s*', body): + body = body.replace(i.group(0), "") + c_option = Comment(author_id=AUTOPOLLER_ID, + parent_submission=c.parent_submission, + parent_comment_id=c.id, + level=c.level+1, + body_html=filter_title(i.group(1)), + upvotes=0 + ) + g.db.add(c_option) + body_html = sanitize(CustomRenderer().render(mistletoe.Document(body))) if v.marseyawarded and len(list(re.finditer('>[^<\s+]|[^>\s+]<', body_html))) > 0: return {"error":"You can only type marseys!"}, 403 @@ -816,7 +828,7 @@ def edit_comment(cid, v): g.db.commit() - return c.body_html + return c.body_html + c.options_html(v) @app.post("/delete/comment/# | Name | Score |
---|---|---|
{{loop.index}} | {{user.truecoins}} |