forked from rDrama/rDrama
1
0
Fork 0

fix reply button

master
Aevann 2024-05-17 00:04:18 +03:00
parent a142c5535a
commit 4e776bd4d6
4 changed files with 8 additions and 6 deletions

View File

@ -1150,6 +1150,11 @@ class User(Base):
def is_permabanned(self):
return (self.is_banned and not self.unban_utc)
@property
@lazy
def is_underage(self):
return self.is_suspended and 'underage' in self.ban_reason.lower()
@property
@lazy
def applications(self):

View File

@ -282,8 +282,6 @@ def api(v):
@auth_desired
def contact(v):
listing, total, page = modmail_listing(v)
err = v and v.is_suspended and 'underage' in v.ban_reason.lower()
print(err, flush=True)
return render_template("contact.html",
v=v,
listing=listing,
@ -291,7 +289,6 @@ def contact(v):
page=page,
standalone=True,
render_replies=True,
err=err,
)
@app.post("/contact")

View File

@ -87,7 +87,7 @@ def get_logged_in_user():
else:
session.pop("lo_user")
if request.path != '/contact' and v and v.is_suspended and 'underage' in v.ban_reason.lower():
if request.path not in {'/contact', '/reply'} and v and v.is_underage:
abort(406)
if request.method != "GET" and get_setting('read_only_mode') and not (v and v.admin_level >= PERMS['BYPASS_SITE_READ_ONLY_MODE']):

View File

@ -177,7 +177,7 @@
{% if not request.path.startswith('/search/') %}
<div class="flex-grow-1 d-fl {% if not v %}pad{% endif %}">
<form class="form-inline search d-mob-none flex-nowrap mx-0 mx-lg-auto mb-0" {% if err %}style="margin-right:40rem!important"{% endif %} action="{% if request.path.startswith('/search') %}{{request.path}}{% else %}/search/posts/{% endif %}" method="get">
<form class="form-inline search d-mob-none flex-nowrap mx-0 mx-lg-auto mb-0" {% if err or v and v.is_underage %}style="margin-right:40rem!important"{% endif %} action="{% if request.path.startswith('/search') %}{{request.path}}{% else %}/search/posts/{% endif %}" method="get">
<input autocomplete="off" class="form-control w-100" type="search" placeholder="{{search_placeholder}}" name="q" value="{{request.values.get('q', '')}}">
<span class="input-group-append">
<span class="input-group-text border-0 bg-transparent" style="margin-left: -2.5rem">
@ -226,7 +226,7 @@
{% endif %}
{% endif %}
{% if not err %}
{% if not err and not (v and v.is_underage) %}
{% if v and v.admin_level >= PERMS['ADMIN_HOME_VISIBLE'] %}
<a class="mobile-nav-icon d-md-none" href="/admin" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Admin Tools">
<i class="fas fa-crown align-middle text-gray-500 black"></i>