forked from rDrama/rDrama
allow JL4 to unpin award pins
parent
c1268d396b
commit
757c244f65
|
@ -475,6 +475,7 @@ PERMS = { # Minimum admin_level to perform action.
|
||||||
'BLACKJACK_NOTIFICATIONS': 4,
|
'BLACKJACK_NOTIFICATIONS': 4,
|
||||||
'IGNORE_BADGE_BLACKLIST': 4,
|
'IGNORE_BADGE_BLACKLIST': 4,
|
||||||
'PROGSTACK': 4,
|
'PROGSTACK': 4,
|
||||||
|
'UNDO_AWARD_PINS': 4,
|
||||||
'SEE_GHOST_VOTES': 5,
|
'SEE_GHOST_VOTES': 5,
|
||||||
'MODS_EVERY_HOLE': 5,
|
'MODS_EVERY_HOLE': 5,
|
||||||
}
|
}
|
||||||
|
|
|
@ -1379,8 +1379,11 @@ def distinguish_post(post_id, v):
|
||||||
@admin_level_required(PERMS['POST_COMMENT_MODERATION'])
|
@admin_level_required(PERMS['POST_COMMENT_MODERATION'])
|
||||||
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 FEATURES['AWARDS'] and post.stickied and post.stickied.endswith(PIN_AWARD_TEXT):
|
if post.is_banned:
|
||||||
|
abort(403, "Can't sticky removed posts!")
|
||||||
|
|
||||||
|
if FEATURES['AWARDS'] and post.stickied and post.stickied.endswith(PIN_AWARD_TEXT) and v.admin_level < PERMS["UNDO_PIN_AWARDS"]:
|
||||||
abort(403, "Can't pin award pins!")
|
abort(403, "Can't pin award pins!")
|
||||||
|
|
||||||
pins = g.db.query(Submission).filter(Submission.stickied != None, Submission.is_banned == False).count()
|
pins = g.db.query(Submission).filter(Submission.stickied != None, Submission.is_banned == False).count()
|
||||||
|
@ -1421,8 +1424,11 @@ def sticky_post(post_id, v):
|
||||||
def unsticky_post(post_id, v):
|
def unsticky_post(post_id, v):
|
||||||
post = get_post(post_id)
|
post = get_post(post_id)
|
||||||
if post.stickied:
|
if post.stickied:
|
||||||
if FEATURES['AWARDS'] and post.stickied.endswith(PIN_AWARD_TEXT): abort(403, "Can't unpin award pins!")
|
if FEATURES['AWARDS'] and post.stickied.endswith(PIN_AWARD_TEXT) and v.admin_level < PERMS["UNDO_PIN_AWARDS"]:
|
||||||
if post.author_id == LAWLZ_ID and post.stickied_utc and SITE_NAME == 'rDrama': abort(403, "Can't unpin lawlzposts!")
|
abort(403, "Can't unpin award pins!")
|
||||||
|
|
||||||
|
if post.author_id == LAWLZ_ID and post.stickied_utc and SITE_NAME == 'rDrama':
|
||||||
|
abort(403, "Can't unpin lawlzposts!")
|
||||||
|
|
||||||
post.stickied = None
|
post.stickied = None
|
||||||
post.stickied_utc = None
|
post.stickied_utc = None
|
||||||
|
@ -1446,9 +1452,12 @@ def unsticky_post(post_id, v):
|
||||||
@admin_level_required(PERMS['POST_COMMENT_MODERATION'])
|
@admin_level_required(PERMS['POST_COMMENT_MODERATION'])
|
||||||
def sticky_comment(cid, v):
|
def sticky_comment(cid, v):
|
||||||
comment = get_comment(cid, v=v)
|
comment = get_comment(cid, v=v)
|
||||||
|
|
||||||
if comment.is_banned:
|
if comment.is_banned:
|
||||||
abort(403, "Can't sticky removed comments!")
|
abort(403, "Can't sticky removed comments!")
|
||||||
|
|
||||||
|
if FEATURES['AWARDS'] and comment.stickied and comment.stickied.endswith(PIN_AWARD_TEXT) and v.admin_level < PERMS["UNDO_PIN_AWARDS"]:
|
||||||
|
abort(403, "Can't pin award pins!")
|
||||||
|
|
||||||
if not comment.stickied:
|
if not comment.stickied:
|
||||||
comment.stickied = v.username
|
comment.stickied = v.username
|
||||||
|
@ -1481,7 +1490,8 @@ def unsticky_comment(cid, v):
|
||||||
comment = get_comment(cid, v=v)
|
comment = get_comment(cid, v=v)
|
||||||
|
|
||||||
if comment.stickied:
|
if comment.stickied:
|
||||||
if FEATURES['AWARDS'] and comment.stickied.endswith(PIN_AWARD_TEXT): abort(403, "Can't unpin award pins!")
|
if FEATURES['AWARDS'] and comment.stickied.endswith(PIN_AWARD_TEXT) and v.admin_level < PERMS["UNDO_PIN_AWARDS"]:
|
||||||
|
abort(403, "Can't unpin award pins!")
|
||||||
|
|
||||||
comment.stickied = None
|
comment.stickied = None
|
||||||
g.db.add(comment)
|
g.db.add(comment)
|
||||||
|
|
Loading…
Reference in New Issue