forked from MarseyWorld/MarseyWorld
stickies: allow JL2 to sticky post
stickies: unpin on removal stickies: don't allow removed posts to be stickiedmaster
parent
7e4b35bc78
commit
dbb7296dd7
|
@ -190,7 +190,7 @@ PERMS = { # Minimum admin_level to perform action.
|
||||||
'POST_TO_POLL_THREAD': 2,
|
'POST_TO_POLL_THREAD': 2,
|
||||||
'POST_BETS': 3,
|
'POST_BETS': 3,
|
||||||
'POST_BETS_DISTRIBUTE': 3, # probably should be the same as POST_BETS but w/e
|
'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_MARSEYS': 3,
|
||||||
'VIEW_PENDING_SUBMITTED_HATS': 3,
|
'VIEW_PENDING_SUBMITTED_HATS': 3,
|
||||||
'MODERATE_PENDING_SUBMITTED_MARSEYS': 3, # note: there is an extra check so that only """carp""" can approve them
|
'MODERATE_PENDING_SUBMITTED_MARSEYS': 3, # note: there is an extra check so that only """carp""" can approve them
|
||||||
|
|
|
@ -1121,11 +1121,11 @@ def remove_post(post_id, v):
|
||||||
post = get_post(post_id)
|
post = get_post(post_id)
|
||||||
post.is_banned = True
|
post.is_banned = True
|
||||||
post.is_approved = None
|
post.is_approved = None
|
||||||
|
post.stickied = None
|
||||||
|
post.is_pinned = False
|
||||||
post.ban_reason = v.username
|
post.ban_reason = v.username
|
||||||
g.db.add(post)
|
g.db.add(post)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ma=ModAction(
|
ma=ModAction(
|
||||||
kind="ban_post",
|
kind="ban_post",
|
||||||
user_id=v.id,
|
user_id=v.id,
|
||||||
|
@ -1205,9 +1205,8 @@ def distinguish_post(post_id, v):
|
||||||
@admin_level_required(PERMS['POST_COMMENT_MODERATION'])
|
@admin_level_required(PERMS['POST_COMMENT_MODERATION'])
|
||||||
@feature_required('PINS')
|
@feature_required('PINS')
|
||||||
def sticky_post(post_id, v):
|
def sticky_post(post_id, v):
|
||||||
|
|
||||||
post = get_post(post_id)
|
post = get_post(post_id)
|
||||||
|
if post.is_banned: abort(403, "Can't sticky removed posts!")
|
||||||
if post.stickied.endswith('(pin award)'):
|
if post.stickied.endswith('(pin award)'):
|
||||||
abort(403, "Can't pin award pins!")
|
abort(403, "Can't pin award pins!")
|
||||||
|
|
||||||
|
|
|
@ -219,8 +219,8 @@ def award_thing(v, thing_type, id):
|
||||||
author.unban_utc = int(time.time()) + 30 * 86400
|
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!")
|
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":
|
elif kind == "pin":
|
||||||
if not FEATURES['PINS']:
|
if not FEATURES['PINS']: abort(403)
|
||||||
abort(403)
|
if thing.is_banned: abort(403)
|
||||||
if thing.stickied and thing.stickied_utc:
|
if thing.stickied and thing.stickied_utc:
|
||||||
thing.stickied_utc += 3600
|
thing.stickied_utc += 3600
|
||||||
else:
|
else:
|
||||||
|
@ -232,7 +232,7 @@ def award_thing(v, thing_type, id):
|
||||||
g.db.add(thing)
|
g.db.add(thing)
|
||||||
cache.delete_memoized(frontlist)
|
cache.delete_memoized(frontlist)
|
||||||
elif kind == "unpin":
|
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.author_id == LAWLZ_ID and SITE_NAME == 'rDrama': abort(403, "You can't unpin lawlzposts!")
|
||||||
|
|
||||||
if thing_type == 'comment':
|
if thing_type == 'comment':
|
||||||
|
|
Loading…
Reference in New Issue