pins: fix removal behavior
parent
33878fcd02
commit
750a87713f
|
@ -1103,7 +1103,7 @@ def unban_user(user_id, v):
|
||||||
if not user.is_banned:
|
if not user.is_banned:
|
||||||
abort(400)
|
abort(400)
|
||||||
|
|
||||||
if FEATURES["AWARDS"] and user.ban_reason and user.ban_reason.startswith('1-Day ban award'):
|
if FEATURES['AWARDS'] and user.ban_reason and user.ban_reason.startswith('1-Day ban award'):
|
||||||
abort(403, "You can't undo a ban award!")
|
abort(403, "You can't undo a ban award!")
|
||||||
|
|
||||||
user.is_banned = 0
|
user.is_banned = 0
|
||||||
|
@ -1173,7 +1173,7 @@ 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
|
||||||
if FEATURES["AWARDS"] and post.stickied and not post.stickied.endswith(PIN_AWARD_TEXT):
|
if not FEATURES['AWARDS'] or not post.stickied or not post.stickied.endswith(PIN_AWARD_TEXT):
|
||||||
post.stickied = None
|
post.stickied = None
|
||||||
post.is_pinned = False
|
post.is_pinned = False
|
||||||
post.ban_reason = v.username
|
post.ban_reason = v.username
|
||||||
|
@ -1257,7 +1257,7 @@ def distinguish_post(post_id, v):
|
||||||
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.is_banned: abort(403, "Can't sticky removed posts!")
|
||||||
if FEATURES["AWARDS"] and post.stickied and post.stickied.endswith(PIN_AWARD_TEXT):
|
if FEATURES['AWARDS'] and post.stickied and post.stickied.endswith(PIN_AWARD_TEXT):
|
||||||
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()
|
||||||
|
@ -1297,7 +1297,7 @@ 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): 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!")
|
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
|
||||||
|
@ -1346,7 +1346,7 @@ 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): 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