forked from rDrama/rDrama
simplify house checking logic
parent
1fb897a309
commit
ae90eb1cf2
|
@ -376,7 +376,7 @@ class Comment(Base):
|
|||
|
||||
if v:
|
||||
sub = self.post.sub
|
||||
if sub in ('furry','vampire','racist','femboy') and not (v.house and v.house.lower().startswith(sub)): body += ' disabled '
|
||||
if sub in ('furry','vampire','racist','femboy') and not v.house.lower().startswith(sub): body += ' disabled '
|
||||
body += f''' onchange="poll_vote_{o.exclusive}('{o.id}', '{self.id}', 'comment')"'''
|
||||
else:
|
||||
body += f''' onchange="poll_vote_no_v()"'''
|
||||
|
|
|
@ -387,7 +387,7 @@ class Submission(Base):
|
|||
|
||||
if v:
|
||||
sub = self.sub
|
||||
if sub in ('furry','vampire','racist','femboy') and not (v.house and v.house.lower().startswith(sub)): body += ' disabled '
|
||||
if sub in ('furry','vampire','racist','femboy') and not v.house.lower().startswith(sub): body += ' disabled '
|
||||
body += f''' onchange="poll_vote_{o.exclusive}('{o.id}', '{self.id}', 'post')"'''
|
||||
else:
|
||||
body += f''' onchange="poll_vote_no_v()"'''
|
||||
|
|
|
@ -49,7 +49,7 @@ class User(Base):
|
|||
highres = Column(String)
|
||||
profileurl = Column(String)
|
||||
bannerurl = Column(String)
|
||||
house = Column(String)
|
||||
house = Column(String, default='')
|
||||
old_house = Column(String)
|
||||
patron = Column(Integer, default=0)
|
||||
patron_utc = Column(Integer, default=0)
|
||||
|
|
|
@ -148,7 +148,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.client 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.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)
|
||||
|
|
|
@ -18,7 +18,7 @@ def vote_option(option_id, v):
|
|||
|
||||
sub = option.post.sub
|
||||
|
||||
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.house.lower().startswith(sub):
|
||||
return {"error": f"You need to be a member of House {sub.capitalize()} to vote on polls in /h/{sub}"}
|
||||
|
||||
if option.exclusive == 2:
|
||||
|
@ -84,7 +84,7 @@ def vote_option_comment(option_id, v):
|
|||
|
||||
sub = option.comment.post.sub
|
||||
|
||||
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.house.lower().startswith(sub):
|
||||
return {"error": f"You need to be a member of House {sub.capitalize()} to vote on polls in /h/{sub}"}
|
||||
|
||||
if option.exclusive:
|
||||
|
|
|
@ -695,7 +695,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.client 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.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':
|
||||
|
|
|
@ -52,7 +52,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 v.client 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.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:
|
||||
|
|
|
@ -243,7 +243,7 @@ def add_mod(v, sub):
|
|||
|
||||
user = get_user(user)
|
||||
|
||||
if sub in ('furry','vampire','racist','femboy') and not v.client 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.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()
|
||||
|
|
Loading…
Reference in New Issue