give visible bots a body column (so their comments are searchable)

+ don't sanitize zoz/longpostbot/aj comments
master
Aevann1 2022-06-18 17:37:01 +02:00
parent 8d83c6944b
commit 56f8cf793e
3 changed files with 1036 additions and 1041 deletions

File diff suppressed because one or more lines are too long

View File

@ -460,7 +460,7 @@ def api_comment(v):
body = AGENDAPOSTER_MSG.format(username=v.username, type='comment', AGENDAPOSTER_PHRASE=AGENDAPOSTER_PHRASE) body = AGENDAPOSTER_MSG.format(username=v.username, type='comment', AGENDAPOSTER_PHRASE=AGENDAPOSTER_PHRASE)
body_jannied_html = sanitize(body) body_jannied_html = AGENDAPOSTER_MSG_HTML.format(id=v.id, username=v.username, type='comment', AGENDAPOSTER_PHRASE=AGENDAPOSTER_PHRASE)
@ -470,6 +470,7 @@ def api_comment(v):
parent_comment_id=c.id, parent_comment_id=c.id,
level=level+1, level=level+1,
is_bot=True, is_bot=True,
body=body,
body_html=body_jannied_html, body_html=body_jannied_html,
top_comment_id=c.top_comment_id, top_comment_id=c.top_comment_id,
ghost=c.ghost ghost=c.ghost
@ -498,15 +499,13 @@ def api_comment(v):
c.downvotes = 1 c.downvotes = 1
body_html2 = sanitize(body)
c2 = Comment(author_id=LONGPOSTBOT_ID, c2 = Comment(author_id=LONGPOSTBOT_ID,
parent_submission=parent_submission, parent_submission=parent_submission,
parent_comment_id=c.id, parent_comment_id=c.id,
level=level+1, level=level+1,
is_bot=True, is_bot=True,
body_html=body_html2, body=body,
body_html=f"<p>{body}</p>",
top_comment_id=c.top_comment_id, top_comment_id=c.top_comment_id,
ghost=c.ghost ghost=c.ghost
) )
@ -525,19 +524,13 @@ def api_comment(v):
if SITE_NAME == 'rDrama' and random.random() < 0.001: if SITE_NAME == 'rDrama' and random.random() < 0.001:
body = "zoz"
body_html2 = sanitize(body)
c2 = Comment(author_id=ZOZBOT_ID, c2 = Comment(author_id=ZOZBOT_ID,
parent_submission=parent_submission, parent_submission=parent_submission,
parent_comment_id=c.id, parent_comment_id=c.id,
level=level+1, level=level+1,
is_bot=True, is_bot=True,
body_html=body_html2, body="zoz",
body_html="<p>zoz</p>",
top_comment_id=c.top_comment_id, top_comment_id=c.top_comment_id,
ghost=c.ghost, ghost=c.ghost,
distinguish_level=6 distinguish_level=6
@ -550,19 +543,13 @@ def api_comment(v):
body = "zle"
body_html2 = sanitize(body)
c3 = Comment(author_id=ZOZBOT_ID, c3 = Comment(author_id=ZOZBOT_ID,
parent_submission=parent_submission, parent_submission=parent_submission,
parent_comment_id=c2.id, parent_comment_id=c2.id,
level=level+2, level=level+2,
is_bot=True, is_bot=True,
body_html=body_html2, body="zle",
body_html="<p>zle</p>",
top_comment_id=c.top_comment_id, top_comment_id=c.top_comment_id,
ghost=c.ghost, ghost=c.ghost,
distinguish_level=6 distinguish_level=6
@ -571,16 +558,14 @@ def api_comment(v):
g.db.add(c3) g.db.add(c3)
g.db.flush() g.db.flush()
body = "zozzle"
body_html2 = sanitize(body)
c4 = Comment(author_id=ZOZBOT_ID, c4 = Comment(author_id=ZOZBOT_ID,
parent_submission=parent_submission, parent_submission=parent_submission,
parent_comment_id=c3.id, parent_comment_id=c3.id,
level=level+3, level=level+3,
is_bot=True, is_bot=True,
body_html=body_html2, body="zozzle",
body_html="<p>zozzle</p>",
top_comment_id=c.top_comment_id, top_comment_id=c.top_comment_id,
ghost=c.ghost, ghost=c.ghost,
distinguish_level=6 distinguish_level=6
@ -794,7 +779,7 @@ def edit_comment(cid, v):
body = AGENDAPOSTER_MSG.format(username=v.username, type='comment', AGENDAPOSTER_PHRASE=AGENDAPOSTER_PHRASE) body = AGENDAPOSTER_MSG.format(username=v.username, type='comment', AGENDAPOSTER_PHRASE=AGENDAPOSTER_PHRASE)
body_jannied_html = sanitize(body) body_jannied_html = AGENDAPOSTER_MSG_HTML.format(id=v.id, username=v.username, type='comment', AGENDAPOSTER_PHRASE=AGENDAPOSTER_PHRASE)
@ -804,6 +789,7 @@ def edit_comment(cid, v):
parent_comment_id=c.id, parent_comment_id=c.id,
level=c.level+1, level=c.level+1,
is_bot=True, is_bot=True,
body=body,
body_html=body_jannied_html, body_html=body_jannied_html,
top_comment_id=c.top_comment_id, top_comment_id=c.top_comment_id,
ghost=c.ghost ghost=c.ghost

View File

@ -536,7 +536,7 @@ def edit_post(pid, v):
body = AGENDAPOSTER_MSG.format(username=v.username, type='post', AGENDAPOSTER_PHRASE=AGENDAPOSTER_PHRASE) body = AGENDAPOSTER_MSG.format(username=v.username, type='post', AGENDAPOSTER_PHRASE=AGENDAPOSTER_PHRASE)
body_jannied_html = sanitize(body) body_jannied_html = AGENDAPOSTER_MSG_HTML.format(id=v.id, username=v.username, type='post', AGENDAPOSTER_PHRASE=AGENDAPOSTER_PHRASE)
c_jannied = Comment(author_id=NOTIFICATIONS_ID, c_jannied = Comment(author_id=NOTIFICATIONS_ID,
parent_submission=p.id, parent_submission=p.id,
@ -546,6 +546,7 @@ def edit_post(pid, v):
app_id=None, app_id=None,
stickied='AutoJanny', stickied='AutoJanny',
distinguish_level=6, distinguish_level=6,
body=body,
body_html=body_jannied_html, body_html=body_jannied_html,
ghost=p.ghost ghost=p.ghost
) )
@ -1136,8 +1137,7 @@ def submit_post(v, sub=None):
body = AGENDAPOSTER_MSG.format(username=v.username, type='post', AGENDAPOSTER_PHRASE=AGENDAPOSTER_PHRASE) body = AGENDAPOSTER_MSG.format(username=v.username, type='post', AGENDAPOSTER_PHRASE=AGENDAPOSTER_PHRASE)
body_jannied_html = sanitize(body) body_jannied_html = AGENDAPOSTER_MSG_HTML.format(id=v.id, username=v.username, type='post', AGENDAPOSTER_PHRASE=AGENDAPOSTER_PHRASE)
c_jannied = Comment(author_id=NOTIFICATIONS_ID, c_jannied = Comment(author_id=NOTIFICATIONS_ID,
@ -1148,6 +1148,7 @@ def submit_post(v, sub=None):
app_id=None, app_id=None,
stickied='AutoJanny', stickied='AutoJanny',
distinguish_level=6, distinguish_level=6,
body=body,
body_html=body_jannied_html, body_html=body_jannied_html,
ghost=post.ghost ghost=post.ghost
) )
@ -1250,6 +1251,7 @@ def submit_post(v, sub=None):
over_18=False, over_18=False,
is_bot=True, is_bot=True,
app_id=None, app_id=None,
body=body,
body_html=body_html, body_html=body_html,
ghost=post.ghost ghost=post.ghost
) )