exclude authorized bots from hole restrictions

master
Aevann1 2022-09-01 22:01:03 +02:00
parent f02834c29b
commit 8e74171d9d
5 changed files with 5 additions and 4 deletions

View File

@ -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

View File

@ -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)

View File

@ -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':

View File

@ -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:

View File

@ -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()