Make pin disabling site-specific.

remotes/1693045480750635534/spooky-22
Snakes 2022-06-28 02:26:52 -04:00
parent 42a6b5731a
commit 08c2ec7223
5 changed files with 17 additions and 8 deletions

View File

@ -145,6 +145,7 @@ HOLE_REQUIRED = False
HOLE_COST = 0
HOLE_CREATE_JL_MIN = 0
HOLE_INACTIVITY_DELETION = False
PIN_ENABLED = True
PIN_LIMIT = 3
POST_RATE_LIMIT = '1/second;2/minute;10/hour;50/day'
LOGGEDIN_ACTIVE_TIME = 15 * 60
@ -195,6 +196,8 @@ LOTTERY_DURATION = 60 * 60 * 24 * 7
if SITE in {'rdrama.net', 'devrama.xyz'}:
HOLE_COST = 50000
HOLE_INACTIVITY_DELETION = True
PIN_ENABLED = False
NOTIFICATIONS_ID = 1046
AUTOJANNY_ID = 2360
SNAPPY_ID = 261

View File

@ -1254,7 +1254,9 @@ def api_distinguish_post(post_id, v):
@app.post("/sticky/<post_id>")
@admin_level_required(2)
def sticky_post(post_id, v):
abort(403)
if not PIN_ENABLED:
abort(403)
post = get_post(post_id)
if post and not post.stickied:
pins = g.db.query(Submission).filter(Submission.stickied != None, Submission.is_banned == False).count()

View File

@ -197,7 +197,8 @@ def award_thing(v, thing_type, id):
if note: text += f" ({note})"
notify_mod_action(v.id, text)
elif kind == "pin":
abort(403)
if not PIN_ENABLED:
abort(403)
if thing.stickied and thing.stickied_utc:
thing.stickied_utc += 3600
else:
@ -271,7 +272,8 @@ def award_thing(v, thing_type, id):
author.fish = True
badge_grant(badge_id=90, user=author)
elif kind == "progressivestack":
abort(403)
if not PIN_ENABLED:
abort(403)
if author.progressivestack: author.progressivestack += 21600
else: author.progressivestack = int(time.time()) + 21600
badge_grant(user=author, badge_id=94)

View File

@ -836,7 +836,8 @@ def undelete_comment(cid, v):
@app.post("/pin_comment/<cid>")
@auth_required
def pin_comment(cid, v):
abort(403)
if not PIN_ENABLED:
abort(403)
comment = get_comment(cid, v=v)
if not comment.stickied:
@ -879,7 +880,8 @@ def unpin_comment(cid, v):
@app.post("/mod_pin/<cid>")
@auth_required
def mod_pin(cid, v):
abort(403)
if not PIN_ENABLED:
abort(403)
comment = get_comment(cid, v=v)
if not comment.stickied:

View File

@ -1187,9 +1187,9 @@ def submit_post(v, sub=None):
if body.startswith('!slots'):
check_for_slots_command(body, snappy, c)
# if body.startswith(':#marseypin:') or body.startswith(':#marseypin2:'):
# post.stickied = "Snappy"
# post.stickied_utc = int(time.time()) + 3600
if PIN_ENABLED and (body.startswith(':#marseypin:') or body.startswith(':#marseypin2:')):
post.stickied = "Snappy"
post.stickied_utc = int(time.time()) + 3600
g.db.flush()