From b5d500a98ed9f772fd0f0c6656de163bce483113 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sun, 21 Aug 2022 17:24:16 +0200 Subject: [PATCH] add house holes --- files/routes/comments.py | 3 +++ files/routes/posts.py | 3 +++ files/routes/reporting.py | 6 ++++++ 3 files changed, 12 insertions(+) diff --git a/files/routes/comments.py b/files/routes/comments.py index ab7a189fc..e90fdfd88 100644 --- a/files/routes/comments.py +++ b/files/routes/comments.py @@ -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 diff --git a/files/routes/posts.py b/files/routes/posts.py index e784a7560..5f7b38e0a 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -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() diff --git a/files/routes/reporting.py b/files/routes/reporting.py index 625cc66ac..58cc61104 100644 --- a/files/routes/reporting.py +++ b/files/routes/reporting.py @@ -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)