stickies: allow JL2 to sticky post

stickies: unpin on removal
stickies: don't allow removed posts to be stickied
master
justcool393 2022-10-23 17:17:49 -05:00
parent 7e4b35bc78
commit dbb7296dd7
3 changed files with 7 additions and 8 deletions

View File

@ -190,7 +190,7 @@ PERMS = { # Minimum admin_level to perform action.
'POST_TO_POLL_THREAD': 2,
'POST_BETS': 3,
'POST_BETS_DISTRIBUTE': 3, # probably should be the same as POST_BETS but w/e
'BYPASS_PIN_LIMIT': 3,
'BYPASS_PIN_LIMIT': 2,
'VIEW_PENDING_SUBMITTED_MARSEYS': 3,
'VIEW_PENDING_SUBMITTED_HATS': 3,
'MODERATE_PENDING_SUBMITTED_MARSEYS': 3, # note: there is an extra check so that only """carp""" can approve them

View File

@ -1121,11 +1121,11 @@ def remove_post(post_id, v):
post = get_post(post_id)
post.is_banned = True
post.is_approved = None
post.stickied = None
post.is_pinned = False
post.ban_reason = v.username
g.db.add(post)
ma=ModAction(
kind="ban_post",
user_id=v.id,
@ -1205,9 +1205,8 @@ def distinguish_post(post_id, v):
@admin_level_required(PERMS['POST_COMMENT_MODERATION'])
@feature_required('PINS')
def sticky_post(post_id, v):
post = get_post(post_id)
if post.is_banned: abort(403, "Can't sticky removed posts!")
if post.stickied.endswith('(pin award)'):
abort(403, "Can't pin award pins!")

View File

@ -219,8 +219,8 @@ def award_thing(v, thing_type, id):
author.unban_utc = int(time.time()) + 30 * 86400
send_repeatable_notification(author.id, f"Your account has been banned permanently for {link}. You must [provide the admins](/contact) a timestamped picture of you touching grass/snow/sand/ass to get unbanned!")
elif kind == "pin":
if not FEATURES['PINS']:
abort(403)
if not FEATURES['PINS']: abort(403)
if thing.is_banned: abort(403)
if thing.stickied and thing.stickied_utc:
thing.stickied_utc += 3600
else:
@ -232,7 +232,7 @@ def award_thing(v, thing_type, id):
g.db.add(thing)
cache.delete_memoized(frontlist)
elif kind == "unpin":
if not thing.stickied_utc: abort(403)
if not thing.stickied_utc: abort(400)
if thing.author_id == LAWLZ_ID and SITE_NAME == 'rDrama': abort(403, "You can't unpin lawlzposts!")
if thing_type == 'comment':