From 8e74171d9d5e56d308fe87e826209d67f3730925 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Thu, 1 Sep 2022 22:01:03 +0200 Subject: [PATCH] exclude authorized bots from hole restrictions --- files/classes/user.py | 1 + files/routes/comments.py | 2 +- files/routes/posts.py | 2 +- files/routes/reporting.py | 2 +- files/routes/subs.py | 2 +- 5 files changed, 5 insertions(+), 4 deletions(-) diff --git a/files/classes/user.py b/files/classes/user.py index 380849b99..0399c1bfb 100644 --- a/files/classes/user.py +++ b/files/classes/user.py @@ -827,6 +827,7 @@ class User(Base): @property @lazy def can_see_chudrama(self): + if self.client: return True if self.truecoins >= 5000: return True if self.agendaposter: return True if self.patron: return True diff --git a/files/routes/comments.py b/files/routes/comments.py index b1e0a220f..88b1c6a4f 100644 --- a/files/routes/comments.py +++ b/files/routes/comments.py @@ -153,7 +153,7 @@ def comment(v): sub = parent_post.sub if sub and v.exiled_from(sub): return {"error": f"You're exiled from /h/{sub}"}, 403 - if sub in ('furry','vampire','racist','femboy') and not (v.house and v.house.lower().startswith(sub)): + if sub in ('furry','vampire','racist','femboy') and not v.client and not (v.house and v.house.lower().startswith(sub)): return {"error": f"You need to be a member of House {sub.capitalize()} to comment in /h/{sub}"} if parent_post.club and not (v and (v.paid_dues or v.id == parent_post.author_id)): abort(403) diff --git a/files/routes/posts.py b/files/routes/posts.py index 168f8ff63..6763fea9f 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -700,7 +700,7 @@ def submit_post(v, sub=None): allowed = [x[0] for x in allowed] if v.id not in allowed: return error(f"You don't have sufficient permissions to post in /h/changelog") - if sub in ('furry','vampire','racist','femboy') and not (v.house and v.house.lower().startswith(sub)): + if sub in ('furry','vampire','racist','femboy') and not v.client and not (v.house and v.house.lower().startswith(sub)): return error(f"You need to be a member of House {sub.capitalize()} to post in /h/{sub}") if sub and sub != 'none': diff --git a/files/routes/reporting.py b/files/routes/reporting.py index 58cc61104..8d8eb9d39 100644 --- a/files/routes/reporting.py +++ b/files/routes/reporting.py @@ -49,7 +49,7 @@ def flag_post(pid, v): if post.author.exiled_from(sub_to): return {"error": f"User is exiled from this {HOLE_NAME}!"} - if sub_to in ('furry','vampire','racist','femboy') and not (post.author.house and post.author.house.lower().startswith(sub_to)): + if sub_to in ('furry','vampire','racist','femboy') and not v.client and not (post.author.house and post.author.house.lower().startswith(sub_to)): if v.id == post.author_id: return {"error": f"You need to be a member of House {sub.capitalize()} to post in /h/{sub}"} else: diff --git a/files/routes/subs.py b/files/routes/subs.py index e0f387380..bcd779c83 100644 --- a/files/routes/subs.py +++ b/files/routes/subs.py @@ -241,7 +241,7 @@ def add_mod(v, sub): user = get_user(user) - if sub in ('furry','vampire','racist','femboy') and not (user.house and user.house.lower().startswith(sub)): + if sub in ('furry','vampire','racist','femboy') and not v.client and not (user.house and user.house.lower().startswith(sub)): return {"error": f"@{user.username} needs to be a member of House {sub.capitalize()} to be added as a mod there!"} existing = g.db.query(Mod).filter_by(user_id=user.id, sub=sub).one_or_none()