forked from rDrama/rDrama
pins: remove unnecessary code
parent
8795ecfb58
commit
31eb387c8d
|
@ -1213,21 +1213,17 @@ def sticky_post(post_id, v):
|
|||
|
||||
pins = g.db.query(Submission).filter(Submission.stickied != None, Submission.is_banned == False).count()
|
||||
|
||||
if pins >= PIN_LIMIT and v.admin_level < PERMS['BYPASS_PIN_LIMIT']:
|
||||
if pins >= PIN_LIMIT + 1 and v.admin_level < PERMS['BYPASS_PIN_LIMIT']:
|
||||
abort(403, f"Can't exceed {PIN_LIMIT} pinned posts limit!")
|
||||
|
||||
if not post.stickied_utc:
|
||||
post.stickied_utc = int(time.time()) + 3600
|
||||
pin_time = 'for 1 hour'
|
||||
code = 200
|
||||
if v.id != post.author_id:
|
||||
send_repeatable_notification(post.author_id, f"@{v.username} (Admin) has pinned [{post.title}](/post/{post_id})!")
|
||||
else:
|
||||
if pins >= PIN_LIMIT + 1:
|
||||
abort(403, f"Can't exceed {PIN_LIMIT} pinned posts limit!")
|
||||
post.stickied_utc = None
|
||||
pin_time = 'permanently'
|
||||
code = 201
|
||||
|
||||
post.stickied = v.username
|
||||
|
||||
|
|
Loading…
Reference in New Issue