From efa8751786bb874136d8683d4eef2f1bad99ef5a Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sat, 26 Nov 2022 22:09:07 +0200 Subject: [PATCH] Revert "you posts: constantify truescore requirement" This reverts commit 1b721126a2918016323729eb3984883202c9b06d. --- files/classes/user.py | 15 +++------------ files/helpers/const.py | 17 ++++++----------- files/routes/chat.py | 6 +++--- files/routes/comments.py | 2 +- 4 files changed, 13 insertions(+), 27 deletions(-) diff --git a/files/classes/user.py b/files/classes/user.py index 8993f23c8..9231e27e7 100644 --- a/files/classes/user.py +++ b/files/classes/user.py @@ -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.can_see_you_post: return False + if "!YOU!" in other.title and not (user and (user.client or user.truescore > 5000)): return False if other.sub and not cls.can_see(user, other.subr): return False else: if not other.parent_submission: @@ -1029,19 +1029,10 @@ class User(Base): @property @lazy def can_post_in_ghost_threads(self): - if not TRUESCORE_GHOST_MINIMUM: return True + if not TRUESCORE_GHOST_LIMIT: return True if self.admin_level >= PERMS['POST_IN_GHOST_THREADS']: return True if self.club_allowed: 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.truescore >= TRUESCORE_GHOST_LIMIT: return True if self.patron: return True return False diff --git a/files/helpers/const.py b/files/helpers/const.py index e78b57d33..ad11b2de3 100644 --- a/files/helpers/const.py +++ b/files/helpers/const.py @@ -390,9 +390,8 @@ 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_MINIMUM = 0 -TRUESCORE_GHOST_MINIMUM = 0 -TRUESCORE_YOU_POST_MINIMUM = 0 +TRUESCORE_CHAT_LIMIT = 0 +TRUESCORE_GHOST_LIMIT = 0 LOGGEDIN_ACTIVE_TIME = 15 * 60 PFP_DEFAULT_MARSEY = True @@ -495,9 +494,8 @@ if SITE == 'rdrama.net': NOTIFICATION_THREAD = 6489 CHAT_LENGTH_LIMIT = 200 - TRUESCORE_CHAT_MINIMUM = 10 - TRUESCORE_GHOST_MINIMUM = 10 - TRUESCORE_YOU_POST_MINIMUM = 5000 + TRUESCORE_CHAT_LIMIT = 10 + TRUESCORE_GHOST_LIMIT = 10 NEW_USER_HAT_AGE = 7 * 86400 HOLE_COST = 50000 @@ -572,8 +570,6 @@ elif SITE == 'pcmemes.net': ERROR_MSGS[500] = "Hiiiii it's nigger! I think this error means that there's a nigger error. And I think that means something took too long to load so it decided to be a nigger. If you keep seeing this on the same page but not other pages, then something its probably a niggerfaggot. It may not be called a nigger, but that sounds right to me. Anyway, ping me and I'll whine to someone smarter to fix it. Don't bother them. Thanks ily <3" ERROR_MARSEYS[500] = "wholesome" POST_RATE_LIMIT = '1/second;4/minute;20/hour;100/day' - - TRUESCORE_YOU_POST_MINIMUM = 5000 HOLE_COST = 2000 @@ -633,9 +629,8 @@ elif SITE == 'watchpeopledie.tv': SIDEBAR_THREAD = 5403 BANNER_THREAD = 9869 - TRUESCORE_CHAT_MINIMUM = 10 - TRUESCORE_GHOST_MINIMUM = 10 - TRUESCORE_YOU_POST_MINIMUM = 5000 + TRUESCORE_CHAT_LIMIT = 10 + TRUESCORE_GHOST_LIMIT = 10 HOLE_NAME = 'flair' HOLE_STYLE_FLAIR = True diff --git a/files/routes/chat.py b/files/routes/chat.py index 0a0cc3fdc..1fe22bd89 100644 --- a/files/routes/chat.py +++ b/files/routes/chat.py @@ -39,8 +39,8 @@ user_ids_to_socket_ids = {} @app.get("/chat") @is_not_permabanned def chat(v): - 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.") + 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.") 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_MINIMUM and v.truescore < TRUESCORE_CHAT_MINIMUM and not v.club_allowed: return '', 403 + if TRUESCORE_CHAT_LIMIT and v.truescore < TRUESCORE_CHAT_LIMIT and not v.club_allowed: return '', 403 vname = v.username.lower() if vname in muted and not v.admin_level >= PERMS['CHAT_BYPASS_MUTE']: diff --git a/files/routes/comments.py b/files/routes/comments.py index 334455f16..bc19459c5 100644 --- a/files/routes/comments.py +++ b/files/routes/comments.py @@ -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_MINIMUM} 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_LIMIT} truescore to post in ghost threads") else: abort(400) level = 1 if isinstance(parent, Submission) else parent.level + 1