can post in ghost threads

remotes/1693176582716663532/tmp_refs/heads/watchparty
justcool393 2022-11-14 11:17:29 -06:00
parent 2ab126ef33
commit 000b4f4c37
4 changed files with 16 additions and 1 deletions

View File

@ -975,6 +975,16 @@ class User(Base):
if self.agendaposter: return True
if self.patron: return True
return False
@property
@lazy
def can_post_in_ghost_threads(self):
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_LIMIT: return True
if self.patron: return True
return False
@property
@lazy

View File

@ -229,6 +229,7 @@ PERMS = { # Minimum admin_level to perform action.
'USER_MERGE': 3, # note: extra check for Aevann
'USER_TITLE_CHANGE': 2,
'USER_MODERATION_TOOLS_VISIBLE': 2, # note: does not affect API at all
'POST_IN_GHOST_THREADS': 1,
'POST_TO_CHANGELOG': 1, # note: code contributors can also post to changelog
'POST_TO_POLL_THREAD': 2,
'POST_BETS': 3,
@ -378,6 +379,7 @@ MIN_REPOST_CHECK_URL_LENGTH = 9 # also change the constant in checkRepost() of s
TRUESCORE_DONATE_LIMIT = 100
COSMETIC_AWARD_COIN_AWARD_PCT = 0.10
TRUESCORE_CHAT_LIMIT = 0
TRUESCORE_GHOST_LIMIT = 0
POST_GHOST_COST = 100
LOGGEDIN_ACTIVE_TIME = 15 * 60
@ -476,6 +478,7 @@ if SITE == 'rdrama.net':
NOTIFICATION_THREAD = 6489
TRUESCORE_CHAT_LIMIT = 10
TRUESCORE_GHOST_LIMIT = 10
HOLE_COST = 50000
HOLE_INACTIVITY_DELETION = True
@ -570,6 +573,7 @@ elif SITE == 'watchpeopledie.tv':
BANNER_THREAD = 9869
TRUESCORE_CHAT_LIMIT = 10
TRUESCORE_GHOST_LIMIT = 10
HOLE_NAME = 'flair'
HOLE_STYLE_FLAIR = True

View File

@ -102,6 +102,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: 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

View File

@ -785,7 +785,7 @@ def submit_post(v, sub=None):
flag_over_18 = request.values.get("over_18", False, bool)
flag_private = request.values.get("private", False, bool)
flag_club = (request.values.get("club", False, bool) and FEATURES['COUNTRY_CLUB'])
flag_ghost = request.values.get("ghost", False, bool) and v.charge_account('coins', POST_GHOST_COST)
flag_ghost = request.values.get("ghost", False, bool) and v.can_post_in_ghost_threads
if embed and len(embed) > 1500: embed = None
if embed: embed = embed.strip()