make pin limit only count permapinned posts

pull/228/head
Aevann 2024-06-25 17:38:42 +03:00
parent 964fb15bb5
commit 372fe36be7
2 changed files with 8 additions and 5 deletions

View File

@ -536,7 +536,7 @@ ERROR_MARSEYS = {
EMOJI_SRCS = ['files/assets/emojis.csv']
PIN_LIMIT = 5
PIN_LIMIT = 3
POST_TITLE_LENGTH_LIMIT = 500 # do not make larger than 500 without altering the table
POST_TITLE_HTML_LENGTH_LIMIT = 1500 # do not make larger than 1500 without altering the table
@ -757,7 +757,6 @@ elif SITE in {'watchpeopledie.tv', 'marsey.world'}:
DESCRIPTION = "People die and this is the place to see it. You only have one life, don't make the mistakes seen here."
PIN_LIMIT = 5
WELCOME_MSG = """Hi, you! Welcome to WatchPeopleDie.tv, this really cool site where you can go to watch people die. I'm @CLiTPEELER! If you have any questions about how things work here, or suggestions on how to make them work better than they already do, definitely slide on into my DMs (no fat chicks).\n\nThere's an enormously robust suite of fun features we have here and we're always looking for more to add. Way, way too many to go over in an automated welcome message. And you're probably here for the videos of people dying more than any sort of weird, paradoxical digital community aspect anyway, so I won't bore you with a tedious overview of them. Just head on over to [your settings page](/settings/profile) and have a look at some of the basic profile stuff, at least. You can change your profile picture, username, flair, colors, banners, bio, profile anthem (autoplaying song on your page, like it's MySpace or some shit, hell yeah), CSS, all sorts of things.\n\nOr you can just go back to the main feed and carry on with watching people die. That's what the site is for, after all. Have fun!\n\nAnyway, in closing, WPD is entirely open source. We don't really need new full-time coders or anything, but if you'd like to take a look at our repo - or even submit a PR to change, fix, or add some things - go right ahead! Our codebase lives at https://fsdfsd.net/rDrama/rDrama\n\nWell, that's all. Thanks again for signing up. It's an automated message and all, but I really do mean that. Thank you, specifically. I love you. Romantically. Deeply. Passionately.\n\nHave fun!"""
FEATURES['PATRON_ICONS'] = True

View File

@ -1457,7 +1457,11 @@ def pin_post(post_id, v):
if FEATURES['AWARDS'] and post.pinned and post.pinned.endswith(PIN_AWARD_TEXT) and v.admin_level < PERMS["UNDO_AWARD_PINS"]:
abort(403, "Can't pin award pins!")
pins = g.db.query(Post).filter(Post.pinned != None, Post.is_banned == False).count()
permapinned = g.db.query(Post).filter(
Post.pinned != None,
Post.pinned_utc == None,
Post.is_banned == False,
).count()
if not post.pinned_utc:
post.pinned_utc = int(time.time()) + 3600
@ -1466,8 +1470,8 @@ def pin_post(post_id, v):
if v.id != post.author_id:
send_repeatable_notification(post.author_id, f"@{v.username} (a site admin) has pinned {post.textlink}")
else:
if pins >= PIN_LIMIT + 1:
abort(403, f"Can't exceed {PIN_LIMIT} pinned posts limit!")
if permapinned >= PIN_LIMIT + 1:
abort(403, f"Can't have more than {PIN_LIMIT} perma-pinned posts!")
post.pinned_utc = None
pin_time = 'permanently'
code = 201