add house holes

remotes/1693045480750635534/spooky-22
Aevann1 2022-08-21 17:24:16 +02:00
parent fb2437574f
commit b5d500a98e
3 changed files with 12 additions and 0 deletions

View File

@ -151,6 +151,9 @@ 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)):
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)
rts = False

View File

@ -700,6 +700,9 @@ 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)):
return error(f"You need to be a member of House {sub.capitalize()} to post in /h/{sub}")
if sub and sub != 'none':
sname = sub.strip().lower()
sub = g.db.query(Sub.name).filter_by(name=sname).one_or_none()

View File

@ -49,6 +49,12 @@ 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 v.id == post.author_id:
return {"error": f"You need to be a member of House {sub.capitalize()} to post in /h/{sub}"}
else:
return {"error": f"@{post.author.username} needs to be a member of House {sub.capitalize()} for their post to be moved to /h/{sub}"}
post.sub = sub_to
g.db.add(post)