This commit is contained in:
Aevann1 2021-09-01 17:51:27 +02:00
parent 1d44292f64
commit 7cfa9506df
3 changed files with 27 additions and 53 deletions

View file

@ -26,15 +26,33 @@ def notifications(v):
cids = cids[:25]
comments = get_comments(cids, v=v)
elif posts:
cids = v.notification_subscriptions(page=page)
next_exists = (len(cids) == 26)
cids = cids[:25]
comments = get_comments(cids, v=v)
notifications = v.notifications.join(Notification.comment).filter(Comment.author_id == AUTOJANNY_ACCOUNT).order_by(Notification.id.desc()).offset(25 * (page - 1)).limit(26)
comments = []
for x in notifications:
c = x.comment
if not x.read: c.unread = True
x.read = True
g.db.add(x)
comments.append(c)
next_exists = (len(comments) == 26)
comments = comments[:25]
else:
cids = v.notification_commentlisting(page=page)
next_exists = (len(cids) == 26)
cids = cids[:25]
comments = get_comments(cids, v=v, load_parent=True)
notifications = v.notifications.join(Notification.comment).filter(
Comment.is_banned == False,
Comment.deleted_utc == 0,
Comment.author_id != AUTOJANNY_ACCOUNT,
).order_by(Notification.id.desc()).offset(25 * (page - 1)).limit(26)
comments = []
for x in notifications:
c = x.comment
if not x.read: c.unread = True
x.read = True
g.db.add(x)
comments.append(c)
next_exists = (len(comments) == 26)
comments = comments[:25]
listing = []
for c in comments: