diff --git a/files/classes/user.py b/files/classes/user.py index 6f2a7c345..d6da4ced9 100644 --- a/files/classes/user.py +++ b/files/classes/user.py @@ -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): diff --git a/files/routes/static.py b/files/routes/static.py index a757a72a6..350e73d75 100644 --- a/files/routes/static.py +++ b/files/routes/static.py @@ -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") diff --git a/files/routes/wrappers.py b/files/routes/wrappers.py index 47960289c..32193316c 100644 --- a/files/routes/wrappers.py +++ b/files/routes/wrappers.py @@ -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']): diff --git a/files/templates/header.html b/files/templates/header.html index bbaf863f6..4e2c66050 100644 --- a/files/templates/header.html +++ b/files/templates/header.html @@ -177,7 +177,7 @@ {% if not request.path.startswith('/search/') %}
-