master
Aevann1 2022-05-09 11:32:55 +02:00
parent 5fddfae64c
commit 7ddd5ec76a
2 changed files with 42 additions and 46 deletions

View File

@ -700,31 +700,29 @@ def edit_comment(cid, v):
if v.agendaposter and not v.marseyawarded: if v.agendaposter and not v.marseyawarded:
body = torture_ap(body, v.username) body = torture_ap(body, v.username)
if not c.options: for i in poll_regex.finditer(body):
for i in poll_regex.finditer(body): body = body.replace(i.group(0), "")
body = body.replace(i.group(0), "") c_option = Comment(author_id=AUTOPOLLER_ID,
c_option = Comment(author_id=AUTOPOLLER_ID, parent_submission=c.parent_submission,
parent_submission=c.parent_submission, parent_comment_id=c.id,
parent_comment_id=c.id, level=c.level+1,
level=c.level+1, body_html=filter_emojis_only(i.group(1)),
body_html=filter_emojis_only(i.group(1)), upvotes=0,
upvotes=0, is_bot=True
is_bot=True )
) g.db.add(c_option)
g.db.add(c_option)
if not c.choices: for i in choice_regex.finditer(body):
for i in choice_regex.finditer(body): body = body.replace(i.group(0), "")
body = body.replace(i.group(0), "") c_choice = Comment(author_id=AUTOCHOICE_ID,
c_choice = Comment(author_id=AUTOCHOICE_ID, parent_submission=c.parent_submission,
parent_submission=c.parent_submission, parent_comment_id=c.id,
parent_comment_id=c.id, level=c.level+1,
level=c.level+1, body_html=filter_emojis_only(i.group(1)),
body_html=filter_emojis_only(i.group(1)), upvotes=0,
upvotes=0, is_bot=True
is_bot=True )
) g.db.add(c_choice)
g.db.add(c_choice)
body_html = sanitize(body, edit=True) body_html = sanitize(body, edit=True)

View File

@ -476,29 +476,27 @@ def edit_post(pid, v):
if body != p.body: if body != p.body:
if v.id == p.author_id and v.agendaposter and not v.marseyawarded: body = torture_ap(body, v.username) if v.id == p.author_id and v.agendaposter and not v.marseyawarded: body = torture_ap(body, v.username)
if not p.options: for i in poll_regex.finditer(body):
for i in poll_regex.finditer(body): body = body.replace(i.group(0), "")
body = body.replace(i.group(0), "") c = Comment(author_id=AUTOPOLLER_ID,
c = Comment(author_id=AUTOPOLLER_ID, parent_submission=p.id,
parent_submission=p.id, level=1,
level=1, body_html=filter_emojis_only(i.group(1)),
body_html=filter_emojis_only(i.group(1)), upvotes=0,
upvotes=0, is_bot=True
is_bot=True )
) g.db.add(c)
g.db.add(c)
if not p.choices: for i in choice_regex.finditer(body):
for i in choice_regex.finditer(body): body = body.replace(i.group(0), "")
body = body.replace(i.group(0), "") c = Comment(author_id=AUTOCHOICE_ID,
c = Comment(author_id=AUTOCHOICE_ID, parent_submission=p.id,
parent_submission=p.id, level=1,
level=1, body_html=filter_emojis_only(i.group(1)),
body_html=filter_emojis_only(i.group(1)), upvotes=0,
upvotes=0, is_bot=True
is_bot=True )
) g.db.add(c)
g.db.add(c)
body_html = sanitize(body, edit=True) body_html = sanitize(body, edit=True)