From f52cd1c2ac5868b8f315f3020b3ae09aa4aea051 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Fri, 10 Sep 2021 08:04:28 +0200 Subject: [PATCH] fd --- files/routes/admin.py | 10 +++++----- files/routes/front.py | 14 +++++++------- files/routes/search.py | 4 ++-- files/routes/users.py | 4 ++-- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/files/routes/admin.py b/files/routes/admin.py index 51f5bc796..66b8d2744 100644 --- a/files/routes/admin.py +++ b/files/routes/admin.py @@ -198,7 +198,7 @@ def image_posts_listing(v): firstrange = 25 * (page - 1) secondrange = firstrange+26 posts = [x.id for x in posts if x.is_image][firstrange:secondrange] - next_exists = (len(posts) == 26) + next_exists = (len(posts) > 25) posts = get_posts(posts[:25], v=v) return render_template("admin/image_posts.html", v=v, listing=posts, next_exists=next_exists, page=page, sort="new") @@ -216,7 +216,7 @@ def flagged_posts(v): ).join(Submission.flags).order_by(Submission.id.desc()).offset(25 * (page - 1)).limit(26) listing = [p.id for p in posts] - next_exists = (len(listing) == 26) + next_exists = (len(listing) > 25) listing = listing[:25] listing = get_posts(listing, v=v) @@ -238,7 +238,7 @@ def flagged_comments(v): ).join(Comment.flags).order_by(Comment.id.desc()).offset(25 * (page - 1)).limit(26).all() listing = [p.id for p in posts] - next_exists = (len(listing) == 26) + next_exists = (len(listing) > 25) listing = listing[:25] listing = get_comments(listing, v=v) @@ -401,7 +401,7 @@ def users_list(v): users = [x for x in users] - next_exists = (len(users) == 26) + next_exists = (len(users) > 25) users = users[:25] return render_template("admin/new_users.html", @@ -550,7 +550,7 @@ def admin_removed(v): ids=[x[0] for x in ids] - next_exists = len(ids) == 26 + next_exists = len(ids) > 25 ids = ids[:25] diff --git a/files/routes/front.py b/files/routes/front.py index a48a812b1..dd564795e 100644 --- a/files/routes/front.py +++ b/files/routes/front.py @@ -25,11 +25,11 @@ def notifications(v): firstrange = 25 * (page - 1) secondrange = firstrange + 26 comments = comments[firstrange:secondrange] - next_exists = (len(comments) == 26) + next_exists = (len(comments) > 25) comments = comments[:25] elif messages: cids = v.notification_messages(page=page) - next_exists = (len(cids) == 26) + next_exists = (len(cids) > 25) cids = cids[:25] comments = get_comments(cids, v=v) elif posts: @@ -51,7 +51,7 @@ def notifications(v): Comment.author_id != AUTOJANNY_ACCOUNT, ).order_by(Notification.id.desc()).offset(25 * (page - 1)).limit(26).all() - next_exists = (len(notifications) == 26) + next_exists = (len(notifications) > 25) notifications = notifications[:25] cids = [x.comment_id for x in notifications] comments = get_comments(cids, v=v, load_parent=True) @@ -184,7 +184,7 @@ def frontlist(v=None, sort="hot", page=1, t="all", ids_only=True, filter_words=' abort(400) firstrange = 50 * (page - 1) - secondrange = firstrange+51 + secondrange = firstrange+200 posts = posts[firstrange:secondrange] if random.random() < 0.004: @@ -204,7 +204,7 @@ def frontlist(v=None, sort="hot", page=1, t="all", ids_only=True, filter_words=' post.views = post.views + random.randint(7,10) g.db.add(post) - next_exists = (len(posts) == 51) + next_exists = (len(posts) > 50) posts = posts[:50] @@ -349,7 +349,7 @@ def changelog(v): ) # check existence of next page - next_exists = (len(ids) == 51) + next_exists = (len(ids) > 50) ids = ids[:50] # check if ids exist @@ -449,7 +449,7 @@ def all_comments(v): comments = get_comments(idlist, v=v) - next_exists = len(idlist) == 26 + next_exists = len(idlist) > 25 idlist = idlist[:25] diff --git a/files/routes/search.py b/files/routes/search.py index 354ab61e4..7a826eb4e 100644 --- a/files/routes/search.py +++ b/files/routes/search.py @@ -213,7 +213,7 @@ def searchposts(v): criteria=searchparse(query) total, ids = searchlisting(criteria, v=v, page=page, t=t, sort=sort) - next_exists = (len(ids) == 26) + next_exists = (len(ids) > 25) ids = ids[:25] posts = get_posts(ids, v=v) @@ -255,7 +255,7 @@ def searchcomments(v): criteria=searchparse(query) total, ids = searchcommentlisting(criteria, v=v, page=page, t=t, sort=sort) - next_exists = (len(ids) == 26) + next_exists = (len(ids) > 25) ids = ids[:25] comments = get_comments(ids, v=v) diff --git a/files/routes/users.py b/files/routes/users.py index 071600ecd..36418b872 100644 --- a/files/routes/users.py +++ b/files/routes/users.py @@ -423,7 +423,7 @@ def u_username(username, v=None): ids = u.userpagelisting(v=v, page=page, sort=sort, t=t) # we got 26 items just to see if a next page exists - next_exists = (len(ids) == 26) + next_exists = (len(ids) > 25) ids = ids[:25] # If page 1, check for sticky @@ -526,7 +526,7 @@ def u_username_comments(username, v=None): ) # we got 26 items just to see if a next page exists - next_exists = (len(ids) == 26) + next_exists = (len(ids) > 25) ids = ids[:25] listing = get_comments(ids, v=v)