you posts: constantify truescore requirement

master
justcool393 2022-11-26 13:39:31 -06:00
parent 684dd0c1c1
commit 1b721126a2
4 changed files with 27 additions and 13 deletions

View File

@ -1000,7 +1000,7 @@ class User(Base):
if not cls.can_see(user, other.author): return False
if user and user.id == other.author_id: return True
if isinstance(other, Submission):
if "!YOU!" in other.title and not (user and (user.client or user.truescore > 5000)): return False
if "!YOU!" in other.title and not user.can_see_you_post: return False
if other.sub and not cls.can_see(user, other.subr): return False
else:
if not other.parent_submission:
@ -1029,10 +1029,19 @@ class User(Base):
@property
@lazy
def can_post_in_ghost_threads(self):
if not TRUESCORE_GHOST_LIMIT: return True
if not TRUESCORE_GHOST_MINIMUM: return True
if self.admin_level >= PERMS['POST_IN_GHOST_THREADS']: return True
if self.club_allowed: return True
if self.truescore >= TRUESCORE_GHOST_LIMIT: return True
if self.truescore >= TRUESCORE_GHOST_MINIMUM: return True
if self.patron: return True
if self.client: return True
return False
@property
@lazy
def can_see_you_post(self):
if not TRUESCORE_YOU_POST_MINIMUM: return True
if self.truescore >= TRUESCORE_YOU_POST_MINIMUM: return True
if self.patron: return True
return False

View File

@ -390,8 +390,9 @@ MIN_REPOST_CHECK_URL_LENGTH = 9 # also change the constant in checkRepost() of s
CHAT_LENGTH_LIMIT = 1000
TRUESCORE_DONATE_LIMIT = 100
COSMETIC_AWARD_COIN_AWARD_PCT = 0.10
TRUESCORE_CHAT_LIMIT = 0
TRUESCORE_GHOST_LIMIT = 0
TRUESCORE_CHAT_MINIMUM = 0
TRUESCORE_GHOST_MINIMUM = 0
TRUESCORE_YOU_POST_MINIMUM = 0
LOGGEDIN_ACTIVE_TIME = 15 * 60
PFP_DEFAULT_MARSEY = True
@ -494,8 +495,9 @@ if SITE == 'rdrama.net':
NOTIFICATION_THREAD = 6489
CHAT_LENGTH_LIMIT = 200
TRUESCORE_CHAT_LIMIT = 10
TRUESCORE_GHOST_LIMIT = 10
TRUESCORE_CHAT_MINIMUM = 10
TRUESCORE_GHOST_MINIMUM = 10
TRUESCORE_YOU_POST_MINIMUM = 5000
NEW_USER_HAT_AGE = 7 * 86400
HOLE_COST = 50000
@ -571,6 +573,8 @@ elif SITE == 'pcmemes.net':
ERROR_MARSEYS[500] = "wholesome"
POST_RATE_LIMIT = '1/second;4/minute;20/hour;100/day'
TRUESCORE_YOU_POST_MINIMUM = 5000
HOLE_COST = 2000
AUTOJANNY_ID = 1046
@ -629,8 +633,9 @@ elif SITE == 'watchpeopledie.tv':
SIDEBAR_THREAD = 5403
BANNER_THREAD = 9869
TRUESCORE_CHAT_LIMIT = 10
TRUESCORE_GHOST_LIMIT = 10
TRUESCORE_CHAT_MINIMUM = 10
TRUESCORE_GHOST_MINIMUM = 10
TRUESCORE_YOU_POST_MINIMUM = 5000
HOLE_NAME = 'flair'
HOLE_STYLE_FLAIR = True

View File

@ -39,8 +39,8 @@ user_ids_to_socket_ids = {}
@app.get("/chat")
@is_not_permabanned
def chat(v):
if TRUESCORE_CHAT_LIMIT and v.truescore < TRUESCORE_CHAT_LIMIT and not v.club_allowed:
abort(403, f"Need at least {TRUESCORE_CHAT_LIMIT} truescore for access to chat.")
if TRUESCORE_CHAT_MINIMUM and v.truescore < TRUESCORE_CHAT_MINIMUM and not v.club_allowed:
abort(403, f"Need at least {TRUESCORE_CHAT_MINIMUM} truescore for access to chat.")
return render_template("chat.html", v=v, messages=messages)
@ -50,7 +50,7 @@ def chat(v):
@ratelimit_user("3/second;10/minute")
def speak(data, v):
if v.is_banned: return '', 403
if TRUESCORE_CHAT_LIMIT and v.truescore < TRUESCORE_CHAT_LIMIT and not v.club_allowed: return '', 403
if TRUESCORE_CHAT_MINIMUM and v.truescore < TRUESCORE_CHAT_MINIMUM and not v.club_allowed: return '', 403
vname = v.username.lower()
if vname in muted and not v.admin_level >= PERMS['CHAT_BYPASS_MUTE']:

View File

@ -101,7 +101,7 @@ def comment(v):
parent_post = get_post(parent.parent_submission, v=v)
parent_comment_id = parent.id
if parent.author_id == v.id: rts = True
if not v.can_post_in_ghost_threads and parent_post.ghost: abort(403, f"You need {TRUESCORE_GHOST_LIMIT} truescore to post in ghost threads")
if not v.can_post_in_ghost_threads and parent_post.ghost: abort(403, f"You need {TRUESCORE_GHOST_MINIMUM} truescore to post in ghost threads")
else: abort(400)
level = 1 if isinstance(parent, Submission) else parent.level + 1