make chudtopians immune to chud effects

master
Aevann1 2022-08-20 00:12:53 +02:00
parent 18f024d9c4
commit 4a8220d687
6 changed files with 23 additions and 19 deletions

View File

@ -1127,7 +1127,7 @@ def approve_post(post_id, v):
post = get_post(post_id)
if post.author.id == v.id and post.author.agendaposter and AGENDAPOSTER_PHRASE not in post.body.lower():
if post.author.id == v.id and post.author.agendaposter and AGENDAPOSTER_PHRASE not in post.body.lower() and post.sub != 'chudtopia':
return {"error": "You can't bypass the chud award!"}
if not post:
@ -1322,7 +1322,7 @@ def approve_comment(c_id, v):
comment = get_comment(c_id)
if not comment: abort(404)
if comment.author.id == v.id and comment.author.agendaposter and AGENDAPOSTER_PHRASE not in comment.body.lower():
if comment.author.id == v.id and comment.author.agendaposter and AGENDAPOSTER_PHRASE not in comment.body.lower() and comment.post.sub != 'chudtopia':
return {"error": "You can't bypass the chud award!"}
if comment.is_banned:

View File

@ -280,13 +280,13 @@ def comment(v):
with open(f"snappy_{SITE_NAME}.txt", "a", encoding="utf-8") as f:
f.write('\n{[para]}\n' + body)
if v.agendaposter and not v.marseyawarded and parent_post.id not in ADMIGGERS:
if v.agendaposter and not v.marseyawarded and parent_post.id not in ADMIGGERS and parent_post.sub != 'chudtopia':
body = torture_ap(body, v.username)
body_html = sanitize(body, limit_pings=True)
if parent_post.id not in ADMIGGERS and '!slots' not in body.lower() and '!blackjack' not in body.lower() and '!wordle' not in body.lower() and AGENDAPOSTER_PHRASE not in body.lower():
if parent_post.id not in ADMIGGERS and '!slots' not in body.lower() and '!blackjack' not in body.lower() and '!wordle' not in body.lower() and AGENDAPOSTER_PHRASE not in body.lower() and parent_post.sub != 'chudtopia':
existing = g.db.query(Comment.id).filter(Comment.author_id == v.id,
Comment.deleted_utc == 0,
Comment.parent_comment_id == parent_comment_id,
@ -416,7 +416,7 @@ def comment(v):
n = Notification(comment_id=c_based.id, user_id=v.id)
g.db.add(n)
if v.agendaposter and not v.marseyawarded and AGENDAPOSTER_PHRASE not in c.body.lower():
if v.agendaposter and not v.marseyawarded and AGENDAPOSTER_PHRASE not in c.body.lower() and parent_post.sub != 'chudtopia':
c.is_banned = True
c.ban_reason = "AutoJanny"
@ -654,7 +654,7 @@ def edit_comment(cid, v):
elif v.bird and len(body) > 140:
return {"error":"You have to type less than 140 characters!"}, 403
if v.agendaposter and not v.marseyawarded:
if v.agendaposter and not v.marseyawarded and c.post.sub != 'chudtopia':
body = torture_ap(body, v.username)
for i in poll_regex.finditer(body):
@ -731,7 +731,7 @@ def edit_comment(cid, v):
notif = Notification(comment_id=c.id, user_id=CARP_ID)
g.db.add(notif)
if v.agendaposter and not v.marseyawarded and AGENDAPOSTER_PHRASE not in c.body.lower():
if v.agendaposter and not v.marseyawarded and AGENDAPOSTER_PHRASE not in c.body.lower() and c.post.sub != 'chudtopia':
return {"error": f'You have to include "{AGENDAPOSTER_PHRASE}" in your comment!'}, 403

View File

@ -406,7 +406,8 @@ def edit_post(pid, v):
return {"error":"You have to type less than 140 characters!"}, 403
if title != p.title:
if v.id == p.author_id and v.agendaposter and not v.marseyawarded: title = torture_ap(title, v.username)
if v.id == p.author_id and v.agendaposter and not v.marseyawarded and p.sub != 'chudtopia':
title = torture_ap(title, v.username)
title_html = filter_emojis_only(title, edit=True)
@ -421,7 +422,8 @@ def edit_post(pid, v):
body = body.strip()
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 and p.sub != 'chudtopia':
body = torture_ap(body, v.username)
for i in poll_regex.finditer(body):
body = body.replace(i.group(0), "")
@ -459,7 +461,7 @@ def edit_post(pid, v):
p.body_html = body_html
if v.id == p.author_id and v.agendaposter and not v.marseyawarded and AGENDAPOSTER_PHRASE not in f'{p.body}{p.title}'.lower():
if v.id == p.author_id and v.agendaposter and not v.marseyawarded and AGENDAPOSTER_PHRASE not in f'{p.body}{p.title}'.lower() and p.sub != 'chudtopia':
return {"error": f'You have to include "{AGENDAPOSTER_PHRASE}" in your post!'}, 403
@ -717,7 +719,8 @@ def submit_post(v, sub=None):
if v.is_suspended: return error("You can't perform this action while banned.")
if v.agendaposter and not v.marseyawarded: title = torture_ap(title, v.username)
if v.agendaposter and not v.marseyawarded and sub != 'chudtopia':
title = torture_ap(title, v.username)
title_html = filter_emojis_only(title, graceful=True)
@ -887,7 +890,8 @@ def submit_post(v, sub=None):
choices.append(i.group(1))
body = body.replace(i.group(0), "")
if v.agendaposter and not v.marseyawarded: body = torture_ap(body, v.username)
if v.agendaposter and not v.marseyawarded and sub != 'chudtopia':
body = torture_ap(body, v.username)
body += process_files()
@ -1010,7 +1014,7 @@ def submit_post(v, sub=None):
for x in notify_users:
add_notif(cid, x)
if v.agendaposter and not v.marseyawarded and AGENDAPOSTER_PHRASE not in f'{post.body}{post.title}'.lower():
if v.agendaposter and not v.marseyawarded and AGENDAPOSTER_PHRASE not in f'{post.body}{post.title}'.lower() and sub != 'chudtopia':
post.is_banned = True
post.ban_reason = "AutoJanny"

View File

@ -300,7 +300,7 @@
</style>
{% endif %}
<div id="comment-text-{{c.id}}" class="comment-text mb-0 {% if c.author.agendaposter %}agendaposter{% endif %}">
<div id="comment-text-{{c.id}}" class="comment-text mb-0 {% if c.author.agendaposter and not (c.parent_submission and c.post.sub == 'chudtopia') %}agendaposter{% endif %}">
{{c.realbody(v) | safe}}
</div>
{% if c.parent_submission %}

View File

@ -705,14 +705,14 @@
</div>
{% endif %}
{% if p.realurl(v) and not v_forbid_deleted %}
<h1 id="post-title" class="card-title post-title text-left mb-md-3 {% if p.author.agendaposter %}agendaposter{% endif %}"><a {% if not v or v.newtabexternal %}target="_blank"{% endif %} rel="nofollow noopener noreferrer" href="{{p.realurl(v)}}">
<h1 id="post-title" class="card-title post-title text-left mb-md-3 {% if p.author.agendaposter and p.sub != 'chudtopia' %}agendaposter{% endif %}"><a {% if not v or v.newtabexternal %}target="_blank"{% endif %} rel="nofollow noopener noreferrer" href="{{p.realurl(v)}}">
{% if p.club %}<span class="patron font-weight-bolder mr-1" style="background-color:red; font-size:12px; line-height:2;">{{CC}}</span>{% endif %}
{% if p.category %}{{help.submission_category_tag(p.category.name, p.category.color_text, p.category.color_bg)}}{% endif %}
{% if p.flair %}<span class="patron font-weight-bolder mr-1" style="background-color:var(--primary); font-size:12px; line-height:2;">{{p.flair | safe}}</span>{% endif %}
{{p.realtitle(v) | safe}}
</a></h1>
{% else %}
<h1 id="post-title" class="card-title post-title text-left mb-md-3 {% if p.author.agendaposter %}agendaposter{% endif %}">
<h1 id="post-title" class="card-title post-title text-left mb-md-3 {% if p.author.agendaposter and p.sub != 'chudtopia' %}agendaposter{% endif %}">
{% if p.club %}<span class="patron font-weight-bolder mr-1" style="background-color:red; font-size:12px; line-height:2;">{{CC}}</span>{% endif %}
{% if p.category %}{{help.submission_category_tag(p.category.name, p.category.color_text, p.category.color_bg)}}{% endif %}
{% if p.flair %}<span class="patron font-weight-bolder mr-1" style="background-color:var(--primary); font-size:12px; line-height:2;">{{p.flair | safe}}</span>{% endif %}
@ -748,7 +748,7 @@
{% endif %}
<div id="post-text" {% if p.author.agendaposter %}class="agendaposter"{% endif %}>
<div id="post-text" {% if p.author.agendaposter and p.sub != 'chudtopia' %}class="agendaposter"{% endif %}>
{% if p.is_image %}
<div class="row no-gutters">
<div class="col">

View File

@ -231,7 +231,7 @@
</div>
<h5 class="card-title post-title text-left w-lg-95 mb-0 pb-0 pb-md-1">
<a id="{{p.id}}-title" {% if v and v.newtab and not g.webview %}target="_blank"{% endif %} href="{{p.permalink}}" class="{% if p.sub %}sub{% elif voted and v.id == AEVANN_ID %}visited{% endif %} stretched-link {% if p.author.agendaposter %}agendaposter{% endif %}">
<a id="{{p.id}}-title" {% if v and v.newtab and not g.webview %}target="_blank"{% endif %} href="{{p.permalink}}" class="{% if p.sub %}sub{% elif voted and v.id == AEVANN_ID %}visited{% endif %} stretched-link {% if p.author.agendaposter and p.sub != 'chudtopia' %}agendaposter{% endif %}">
{% if p.club %}<span class="patron font-weight-bolder mr-1" style="background-color:red; font-size:12px; line-height:2;">{{CC}}</span>{% endif %}
{% if p.category %}{{help.submission_category_tag(p.category.name, p.category.color_text, p.category.color_bg)}}{% endif %}
{% if p.flair %}<span class="patron font-weight-bolder mr-1" style="background-color:var(--primary); font-size:12px; line-height:2;">{{p.flair | safe}}</span>{% endif %}
@ -355,7 +355,7 @@
{% if (not p.club or v and (v.paid_dues or v.id == p.author_id)) and not v_forbid_deleted %}
{% if p.realbody(v, True) %}
<div class="d-none card rounded border {% if p.author.agendaposter %}agendaposter{% endif %} post-preview" id="post-text-{{p.id}}">
<div class="d-none card rounded border {% if p.author.agendaposter and p.sub != 'chudtopia' %}agendaposter{% endif %} post-preview" id="post-text-{{p.id}}">
{{p.realbody(v, True) | safe}}
</div>
{% endif %}