master
Aevann1 2021-09-10 08:04:28 +02:00
parent 9c030fb1a5
commit f52cd1c2ac
4 changed files with 16 additions and 16 deletions

View File

@ -198,7 +198,7 @@ def image_posts_listing(v):
firstrange = 25 * (page - 1) firstrange = 25 * (page - 1)
secondrange = firstrange+26 secondrange = firstrange+26
posts = [x.id for x in posts if x.is_image][firstrange:secondrange] 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) 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") 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) ).join(Submission.flags).order_by(Submission.id.desc()).offset(25 * (page - 1)).limit(26)
listing = [p.id for p in posts] listing = [p.id for p in posts]
next_exists = (len(listing) == 26) next_exists = (len(listing) > 25)
listing = listing[:25] listing = listing[:25]
listing = get_posts(listing, v=v) 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() ).join(Comment.flags).order_by(Comment.id.desc()).offset(25 * (page - 1)).limit(26).all()
listing = [p.id for p in posts] listing = [p.id for p in posts]
next_exists = (len(listing) == 26) next_exists = (len(listing) > 25)
listing = listing[:25] listing = listing[:25]
listing = get_comments(listing, v=v) listing = get_comments(listing, v=v)
@ -401,7 +401,7 @@ def users_list(v):
users = [x for x in users] users = [x for x in users]
next_exists = (len(users) == 26) next_exists = (len(users) > 25)
users = users[:25] users = users[:25]
return render_template("admin/new_users.html", return render_template("admin/new_users.html",
@ -550,7 +550,7 @@ def admin_removed(v):
ids=[x[0] for x in ids] ids=[x[0] for x in ids]
next_exists = len(ids) == 26 next_exists = len(ids) > 25
ids = ids[:25] ids = ids[:25]

View File

@ -25,11 +25,11 @@ def notifications(v):
firstrange = 25 * (page - 1) firstrange = 25 * (page - 1)
secondrange = firstrange + 26 secondrange = firstrange + 26
comments = comments[firstrange:secondrange] comments = comments[firstrange:secondrange]
next_exists = (len(comments) == 26) next_exists = (len(comments) > 25)
comments = comments[:25] comments = comments[:25]
elif messages: elif messages:
cids = v.notification_messages(page=page) cids = v.notification_messages(page=page)
next_exists = (len(cids) == 26) next_exists = (len(cids) > 25)
cids = cids[:25] cids = cids[:25]
comments = get_comments(cids, v=v) comments = get_comments(cids, v=v)
elif posts: elif posts:
@ -51,7 +51,7 @@ def notifications(v):
Comment.author_id != AUTOJANNY_ACCOUNT, Comment.author_id != AUTOJANNY_ACCOUNT,
).order_by(Notification.id.desc()).offset(25 * (page - 1)).limit(26).all() ).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] notifications = notifications[:25]
cids = [x.comment_id for x in notifications] cids = [x.comment_id for x in notifications]
comments = get_comments(cids, v=v, load_parent=True) 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) abort(400)
firstrange = 50 * (page - 1) firstrange = 50 * (page - 1)
secondrange = firstrange+51 secondrange = firstrange+200
posts = posts[firstrange:secondrange] posts = posts[firstrange:secondrange]
if random.random() < 0.004: 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) post.views = post.views + random.randint(7,10)
g.db.add(post) g.db.add(post)
next_exists = (len(posts) == 51) next_exists = (len(posts) > 50)
posts = posts[:50] posts = posts[:50]
@ -349,7 +349,7 @@ def changelog(v):
) )
# check existence of next page # check existence of next page
next_exists = (len(ids) == 51) next_exists = (len(ids) > 50)
ids = ids[:50] ids = ids[:50]
# check if ids exist # check if ids exist
@ -449,7 +449,7 @@ def all_comments(v):
comments = get_comments(idlist, v=v) comments = get_comments(idlist, v=v)
next_exists = len(idlist) == 26 next_exists = len(idlist) > 25
idlist = idlist[:25] idlist = idlist[:25]

View File

@ -213,7 +213,7 @@ def searchposts(v):
criteria=searchparse(query) criteria=searchparse(query)
total, ids = searchlisting(criteria, v=v, page=page, t=t, sort=sort) 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] ids = ids[:25]
posts = get_posts(ids, v=v) posts = get_posts(ids, v=v)
@ -255,7 +255,7 @@ def searchcomments(v):
criteria=searchparse(query) criteria=searchparse(query)
total, ids = searchcommentlisting(criteria, v=v, page=page, t=t, sort=sort) 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] ids = ids[:25]
comments = get_comments(ids, v=v) comments = get_comments(ids, v=v)

View File

@ -423,7 +423,7 @@ def u_username(username, v=None):
ids = u.userpagelisting(v=v, page=page, sort=sort, t=t) ids = u.userpagelisting(v=v, page=page, sort=sort, t=t)
# we got 26 items just to see if a next page exists # 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] ids = ids[:25]
# If page 1, check for sticky # 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 # 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] ids = ids[:25]
listing = get_comments(ids, v=v) listing = get_comments(ids, v=v)