remotes/1693045480750635534/spooky-22
Aevann1 2022-05-01 02:53:24 +02:00
parent 003ad5c314
commit 394402c0c1
5 changed files with 24 additions and 20 deletions

View File

@ -12,7 +12,7 @@ from files.__main__ import app
@auth_required
def feeds_user(v=None, sort='hot', t='all'):
try: page = int(request.values.get("page", 1))
try: page = max(int(request.values.get("page", 1)), 1)
except: page = 1
ids, next_exists = frontlist(

View File

@ -38,8 +38,9 @@ def unread(v):
@app.get("/notifications")
@auth_required
def notifications(v):
try: page = int(request.values.get('page', 1))
try: page = max(int(request.values.get("page", 1)), 1)
except: page = 1
messages = request.values.get('messages')
modmail = request.values.get('modmail')
posts = request.values.get('posts')
@ -406,8 +407,8 @@ def frontlist(v=None, sort="hot", page=1, t="all", ids_only=True, ccmode="false"
def changelog(v):
page = int(request.values.get("page") or 1)
page = max(page, 1)
try: page = max(int(request.values.get("page", 1)), 1)
except: page = 1
sort=request.values.get("sort", "new")
t=request.values.get('t', "all")
@ -501,7 +502,7 @@ def random_user(v):
def all_comments(v):
try: page = int(request.values.get("page", 1))
try: page = max(int(request.values.get("page", 1)), 1)
except: page = 1
sort=request.values.get("sort", "new")
@ -591,8 +592,9 @@ def transfers(v):
if request.headers.get("Authorization"): return {"data": [x.json for x in comments.all()]}
try: page = int(request.values.get("page", 1))
try: page = max(int(request.values.get("page", 1)), 1)
except: page = 1
comments = comments.offset(25 * (page - 1)).limit(26).all()
next_exists = len(comments) > 25
comments = comments[:25]

View File

@ -282,7 +282,9 @@ def admins(v):
@auth_required
def log(v):
page = int(request.values.get("page",1))
try: page = max(int(request.values.get("page", 1)), 1)
except: page = 1
admin = request.values.get("admin")
if admin: admin_id = get_id(admin)
else: admin_id = 0

View File

@ -717,6 +717,10 @@ def messagereply(v):
if not notif:
notif = Notification(comment_id=c.id, user_id=user_id)
g.db.add(notif)
ids = [c.top_comment.id] + [x.id for x in c.top_comment.replies]
notifications = g.db.query(Notification).filter(Notification.comment_id.in_(ids), Notification.user_id == user_id)
for n in notifications:
g.db.delete(n)
if PUSHER_ID != 'blahblahblah' and not v.shadowbanned:
if len(message) > 500: notifbody = message[:500] + '...'
@ -746,16 +750,17 @@ def messagereply(v):
)
ids = [c.top_comment.id] + [x.id for x in c.top_comment.replies]
notifications = g.db.query(Notification).filter(Notification.comment_id.in_(ids))
for n in notifications:
g.db.delete(n)
if c.top_comment.sentto == 2:
admins = g.db.query(User).filter(User.admin_level > 2, User.id != v.id).all()
for admin in admins:
notif = Notification(comment_id=c.id, user_id=admin.id)
g.db.add(notif)
ids = [c.top_comment.id] + [x.id for x in c.top_comment.replies]
notifications = g.db.query(Notification).filter(Notification.comment_id.in_(ids))
for n in notifications:
g.db.delete(n)
g.db.commit()
return {"comment": render_template("comments.html", v=v, comments=[c], ajax=True)}
@ -879,9 +884,8 @@ def u_username(username, v=None):
sort = request.values.get("sort", "new")
t = request.values.get("t", "all")
try: page = int(request.values.get("page", "1"))
except: abort(400)
page = max(page, 1)
try: page = max(int(request.values.get("page", 1)), 1)
except: page = 1
ids = u.userpagelisting(v=v, page=page, sort=sort, t=t)

View File

@ -188,11 +188,7 @@
<input id="site_name" type="hidden" value="{{SITE_NAME}}">
<input id="slurreplacer" type="hidden" value="{{v.slurreplacer}}">
<script data-cfasync="false" src="/chat.js?v=15"></script>
<script>
box.scrollTo(0, box.scrollHeight)
</script>
<script src="/chat.js?v=16"></script>
{% include "emoji_modal.html" %}
{% include "expanded_image_modal.html" %}