Revert "bleach all mod notes just in case (and also for easier linkfying)"

This reverts commit 22e5890bcd.
master
Aevann 2024-03-02 23:01:29 +02:00
parent d459de7413
commit 3f3626bf54
10 changed files with 48 additions and 48 deletions

View File

@ -274,7 +274,7 @@ def execute_snappy(post, v):
kind="ban_user",
user_id=snappy.id,
target_user_id=v.id,
_note=filter_emojis_only(f'duration: {duration}, reason: "{reason}"'),
_note=f'duration: {duration}, reason: "{reason}"'
)
g.db.add(ma)
post.bannedfor = f'{duration} by @Snappy'
@ -426,7 +426,7 @@ def tempban_for_spam(v):
kind="ban_user",
user_id=AUTOJANNY_ID,
target_user_id=v.id,
_note=filter_emojis_only(f'duration: for 1 day, reason: "Spam"'),
_note=f'duration: for 1 day, reason: "Spam"'
)
g.db.add(ma)
@ -468,7 +468,7 @@ def execute_antispam_post_check(title, v, url):
user_id=AUTOJANNY_ID,
target_post_id=post.id,
kind="ban_post",
_note="Spam",
_note="Spam"
)
g.db.add(ma)
return False
@ -528,7 +528,7 @@ def execute_antispam_comment_check(body, v):
user_id=AUTOJANNY_ID,
target_comment_id=comment.id,
kind="ban_comment",
_note="Spam",
_note="Spam"
)
g.db.add(ma)
g.db.commit()
@ -576,7 +576,7 @@ def execute_under_siege(v, target, body, kind):
kind="shadowban",
user_id=AUTOJANNY_ID,
target_user_id=v.id,
_note=filter_emojis_only(f'reason: "Under Siege ({reason}, {time_taken})"'),
_note=f'reason: "Under Siege ({reason}, {time_taken})"'
)
g.db.add(ma)

View File

@ -78,7 +78,7 @@ def execute_blackjack(v, target, body, kind):
kind="shadowban",
user_id=AUTOJANNY_ID,
target_user_id=v.id,
_note=filter_emojis_only(f'reason: "Blackjack: {kind}"'),
_note=f'reason: "Blackjack: {kind}"'
)
g.db.add(ma)
@ -632,7 +632,7 @@ def allowed_attributes_emojis(tag, name, value):
@with_sigalrm_timeout(2)
def filter_emojis_only(title, golden=True, count_emojis=False, obj=None, author=None, link=True):
def filter_emojis_only(title, golden=True, count_emojis=False, obj=None, author=None, link=False):
title = title.replace("\n", "").replace("\r", "").replace("\t", "").replace('<','&lt;').replace('>','&gt;')

View File

@ -546,7 +546,7 @@ def badge_grant_post(v):
kind="badge_grant",
user_id=v.id,
target_user_id=user.id,
_note=filter_emojis_only(note),
_note=note,
)
g.db.add(ma)
@ -586,7 +586,7 @@ def badge_remove_post(v):
kind="badge_remove",
user_id=v.id,
target_user_id=user.id,
_note=filter_emojis_only(badge.name),
_note=badge.name
)
g.db.add(ma)
g.db.delete(badge)
@ -740,7 +740,7 @@ def admin_add_alt(v, username):
kind=f"link_accounts",
user_id=v.id,
target_user_id=user1.id,
_note=filter_emojis_only(f'with @{user2.username}'),
_note=f'with @{user2.username}'
)
g.db.add(ma)
return {"message": f"Linked @{user1.username} and @{user2.username} successfully!"}
@ -769,7 +769,7 @@ def admin_delink_relink_alt(v, username, other):
kind=f"delink_accounts",
user_id=v.id,
target_user_id=user1.id,
_note=filter_emojis_only(f'from @{user2.username}'),
_note=f'from @{user2.username}'
)
g.db.add(ma)
@ -899,7 +899,7 @@ def shadowban(user_id, v):
kind="shadowban",
user_id=v.id,
target_user_id=user.id,
_note=filter_emojis_only(f'reason: "{reason}"'),
_note=f'reason: "{reason}"'
)
g.db.add(ma)
@ -952,7 +952,7 @@ def admin_change_flair(user_id, v):
abort(400, "New flair is too long (max 256 characters)")
user.flair = new_flair
new_flair = filter_emojis_only(new_flair)
new_flair = filter_emojis_only(new_flair, link=True)
new_flair = censor_slurs_profanities(new_flair, None)
user = get_account(user.id)
@ -974,7 +974,7 @@ def admin_change_flair(user_id, v):
kind=kind,
user_id=v.id,
target_user_id=user.id,
_note=filter_emojis_only(f'"{new_flair}"'),
_note=f'"{new_flair}"'
)
g.db.add(ma)
@ -1065,7 +1065,7 @@ def ban_user(fullname, v):
kind="ban_user",
user_id=v.id,
target_user_id=user.id,
_note=filter_emojis_only(note),
_note=note
)
g.db.add(ma)
@ -1169,7 +1169,7 @@ def chud(fullname, v):
kind="chud",
user_id=v.id,
target_user_id=user.id,
_note=filter_emojis_only(note),
_note=note
)
g.db.add(ma)
@ -1488,7 +1488,7 @@ def pin_post(post_id, v):
kind="pin_post",
user_id=v.id,
target_post_id=post.id,
_note=filter_emojis_only(pin_time),
_note=pin_time
)
g.db.add(ma)
@ -1686,7 +1686,7 @@ def ban_domain(v):
ma = ModAction(
kind="ban_domain",
user_id=v.id,
_note=filter_emojis_only(f'{domain}, reason: {reason}'),
_note=filter_emojis_only(f'{domain}, reason: {reason}')
)
g.db.add(ma)
@ -1707,7 +1707,7 @@ def unban_domain(v, domain):
ma = ModAction(
kind="unban_domain",
user_id=v.id,
_note=filter_emojis_only(domain),
_note=filter_emojis_only(domain)
)
g.db.add(ma)
@ -1880,7 +1880,7 @@ def delete_media_post(v):
ma = ModAction(
kind="delete_media",
user_id=v.id,
_note=filter_emojis_only(url),
_note=url,
)
g.db.add(ma)
@ -1983,7 +1983,7 @@ def schedule_orgy(v):
ma = ModAction(
kind="schedule_orgy",
user_id=v.id,
_note=filter_emojis_only(data),
_note=data,
)
g.db.add(ma)
@ -1997,7 +1997,7 @@ def remove_orgy(v, created_utc):
ma = ModAction(
kind="remove_orgy",
user_id=v.id,
_note=filter_emojis_only(orgy.data),
_note=orgy.data,
)
g.db.add(ma)
@ -2067,7 +2067,7 @@ def insert_transaction_post(v):
kind="insert_transaction",
user_id=v.id,
target_user_id=user.id,
_note=filter_emojis_only(f'Transaction ID: {id}'),
_note=f'Transaction ID: {id}',
)
g.db.add(ma)

View File

@ -251,7 +251,7 @@ def approve_emoji(v, name):
ma = ModAction(
kind="approve_emoji",
user_id=v.id,
_note=filter_emojis_only(f'<img loading="lazy" data-bs-toggle="tooltip" alt=":{emoji.name}:" title=":{emoji.name}:" src="{SITE_FULL_IMAGES}/e/{emoji.name}.webp">'),
_note=f'<img loading="lazy" data-bs-toggle="tooltip" alt=":{emoji.name}:" title=":{emoji.name}:" src="{SITE_FULL_IMAGES}/e/{emoji.name}.webp">'
)
g.db.add(ma)
@ -303,7 +303,7 @@ def remove_asset(cls, type_name, v, name):
ma = ModAction(
kind=f"reject_{type_name}",
user_id=v.id,
_note=filter_emojis_only(name),
_note=name
)
g.db.add(ma)
@ -467,7 +467,7 @@ def approve_hat(v, name):
ma = ModAction(
kind="approve_hat",
user_id=v.id,
_note=filter_emojis_only(f'<a href="{SITE_FULL_IMAGES}/i/hats/{hat.name}.webp">{hat.name}</a>'),
_note=f'<a href="{SITE_FULL_IMAGES}/i/hats/{hat.name}.webp">{hat.name}</a>'
)
g.db.add(ma)
@ -585,7 +585,7 @@ def update_emoji(v):
ma = ModAction(
kind="update_emoji",
user_id=v.id,
_note=filter_emojis_only(f'<img loading="lazy" data-bs-toggle="tooltip" alt=":{name}:" title=":{name}:" src="{SITE_FULL_IMAGES}/e/{name}.webp">'),
_note=f'<img loading="lazy" data-bs-toggle="tooltip" alt=":{name}:" title=":{name}:" src="{SITE_FULL_IMAGES}/e/{name}.webp">'
)
g.db.add(ma)
@ -684,7 +684,7 @@ def update_hat(v):
ma = ModAction(
kind="update_hat",
user_id=v.id,
_note=filter_emojis_only(f'<a href="{SITE_FULL_IMAGES}/i/hats/{name}.webp">{name}</a>'),
_note=f'<a href="{SITE_FULL_IMAGES}/i/hats/{name}.webp">{name}</a>'
)
g.db.add(ma)

View File

@ -141,7 +141,7 @@ def buy(v, kind):
def alter_body(obj):
obj.body_html = sanitize(obj.body, limit_pings=5, showmore=True, obj=obj, author=obj.author)
if isinstance(obj, Post):
obj.title_html = filter_emojis_only(obj.title, golden=False, obj=obj, author=obj.author, link=False)
obj.title_html = filter_emojis_only(obj.title, golden=False, obj=obj, author=obj.author)
@app.post("/award/<thing_type>/<int:id>")
@limiter.limit('1/second', scope=rpath)
@ -399,7 +399,7 @@ def award_thing(v, thing_type, id):
author.flairchanged += 86400
else:
author.flair = new_flair
new_flair = filter_emojis_only(new_flair)
new_flair = filter_emojis_only(new_flair, link=True)
new_flair = censor_slurs_profanities(new_flair, None)
if len(new_flair) > 1000: abort(403)
author.flair_html = new_flair

View File

@ -364,7 +364,7 @@ def group_change_description(v, group_name):
if len(description) > 100:
abort(400, "New description is too long (max 100 characters)")
description_html = filter_emojis_only(description)
description_html = filter_emojis_only(description, link=True)
if len(description_html) > 1000:
abort(400, "Rendered description is too long!")
else:

View File

@ -41,7 +41,7 @@ def exile_post(v, pid):
kind='exile_user',
user_id=v.id,
target_user_id=u.id,
_note=filter_emojis_only(f'for <a href="{p.permalink}">{p.title_html}</a>'),
_note=f'for <a href="{p.permalink}">{p.title_html}</a>'
)
g.db.add(ma)
@ -80,7 +80,7 @@ def exile_comment(v, cid):
kind='exile_user',
user_id=v.id,
target_user_id=u.id,
_note=filter_emojis_only(f'for <a href="/comment/{c.id}#context">comment</a>'),
_note=f'for <a href="/comment/{c.id}#context">comment</a>'
)
g.db.add(ma)
@ -562,7 +562,7 @@ def upload_hole_sidebar(v, hole):
ma = HoleAction(
hole=hole.name,
kind='upload_sidebar_image',
_note=filter_emojis_only(sidebarurl),
_note=sidebarurl,
user_id=v.id
)
g.db.add(ma)
@ -592,7 +592,7 @@ def delete_hole_sidebar(v, hole, index):
ma = HoleAction(
hole=hole.name,
kind='delete_sidebar_image',
_note=filter_emojis_only(sidebar),
_note=sidebar,
user_id=v.id
)
g.db.add(ma)
@ -651,7 +651,7 @@ def upload_hole_banner(v, hole):
ma = HoleAction(
hole=hole.name,
kind='upload_banner',
_note=filter_emojis_only(bannerurl),
_note=bannerurl,
user_id=v.id
)
g.db.add(ma)
@ -681,7 +681,7 @@ def delete_hole_banner(v, hole, index):
ma = HoleAction(
hole=hole.name,
kind='delete_banner',
_note=filter_emojis_only(banner),
_note=banner,
user_id=v.id
)
g.db.add(ma)
@ -741,7 +741,7 @@ def hole_marsey(v, hole):
ma = HoleAction(
hole=hole.name,
kind='change_marsey',
_note=filter_emojis_only(hole.marseyurl),
_note=hole.marseyurl,
user_id=v.id
)
g.db.add(ma)
@ -1127,7 +1127,7 @@ def change_hole(pid, v):
kind='change_hole',
user_id=v.id,
target_post_id=post.id,
_note=filter_emojis_only(f'{hole_from_str}{hole_to_str}'),
_note=f'{hole_from_str}{hole_to_str}',
)
g.db.add(ma)
position = 'a site admin'
@ -1137,7 +1137,7 @@ def change_hole(pid, v):
kind='change_hole',
user_id=v.id,
target_post_id=post.id,
_note=filter_emojis_only(f'{hole_from_str}{hole_to_str}'),
_note=f'{hole_from_str}{hole_to_str}',
)
g.db.add(ma)
position = f'a /h/{hole_from} mod'

View File

@ -67,7 +67,7 @@ def publish(pid, v):
p.sharpened = v.sharpen and not p.is_longpost
p.rainbowed = v.rainbow and not p.is_longpost
p.title_html = filter_emojis_only(p.title, golden=False, obj=p, author=p.author, link=False)
p.title_html = filter_emojis_only(p.title, golden=False, obj=p, author=p.author)
p.body_html = sanitize(p.body, golden=False, limit_pings=100, obj=p, author=p.author)
if p.draft or not complies_with_chud(p):
@ -606,7 +606,7 @@ def submit_post(v, hole=None):
p.sharpened = v.sharpen and not p.is_longpost
p.rainbowed = v.rainbow and not p.is_longpost
title_html = filter_emojis_only(title, count_emojis=True, obj=p, author=v, link=False)
title_html = filter_emojis_only(title, count_emojis=True, obj=p, author=v)
if v.hieroglyphs and not marseyaward_title_regex.fullmatch(title_html):
abort(400, "You can only type marseys!")
@ -1056,7 +1056,7 @@ def edit_post(pid, v):
if title != p.title:
title_html = filter_emojis_only(title, golden=False, obj=p, author=p.author, link=False)
title_html = filter_emojis_only(title, golden=False, obj=p, author=p.author)
if p.author.hieroglyphs and not marseyaward_title_regex.fullmatch(title_html):
abort(403, "You can only type marseys!")

View File

@ -27,7 +27,7 @@ def report_post(pid, v):
abort(400, "Report reason is too long (max 100 characters)")
og_flair = reason[1:]
reason_html = filter_emojis_only(reason)
reason_html = filter_emojis_only(reason, link=True)
if len(reason_html) > 350:
abort(400, "Rendered report reason is too long!")
@ -39,7 +39,7 @@ def report_post(pid, v):
kind="flair_post",
user_id=v.id,
target_post_id=post.id,
_note=filter_emojis_only(f'"{post.flair}"'),
_note=f'"{post.flair}"'
)
g.db.add(ma)
position = 'a site admin'
@ -49,7 +49,7 @@ def report_post(pid, v):
kind="flair_post",
user_id=v.id,
target_post_id=post.id,
_note=filter_emojis_only(f'"{post.flair}"'),
_note=f'"{post.flair}"'
)
g.db.add(ma)
position = f'a /h/{post.hole} mod'
@ -95,7 +95,7 @@ def report_comment(cid, v):
if len(reason) > 100:
abort(400, "Report reason is too long (max 100 characters)")
reason_html = filter_emojis_only(reason)
reason_html = filter_emojis_only(reason, link=True)
if len(reason_html) > 350:
abort(400, "Rendered report reason is too long!")

View File

@ -990,7 +990,7 @@ def settings_change_flair(v):
flair = process_settings_plaintext("flair", v.flair, 100, None)
if flair:
flair_html = filter_emojis_only(flair)
flair_html = filter_emojis_only(flair, link=True)
flair_html = censor_slurs_profanities(flair_html, None)
if len(flair_html) > 1000: