forked from rDrama/rDrama
master
parent
bfd0d04d9f
commit
47fe4ca887
|
@ -373,11 +373,15 @@ class User(Base, Stndrd, Age_times):
|
|||
def notification_messages(self, page=1):
|
||||
comments = g.db.query(Comment).filter(or_(Comment.author_id==self.id, Comment.sentto==self.id), Comment.parent_submission == None).order_by(Comment.created_utc.desc()).all()
|
||||
|
||||
comments = [c.id for c in comments if c.child_comments == []]
|
||||
comments2 = []
|
||||
for c in comments:
|
||||
if c.child_comments == []:
|
||||
comments2.append(c)
|
||||
if len(comments2) == 26: break
|
||||
|
||||
firstrange = 100 * (page - 1)
|
||||
secondrange = firstrange + 101
|
||||
return comments[firstrange:secondrange]
|
||||
firstrange = 25 * (page - 1)
|
||||
secondrange = firstrange + 26
|
||||
return comments2[firstrange:secondrange]
|
||||
|
||||
@property
|
||||
@lazy
|
||||
|
|
|
@ -29,8 +29,8 @@ def notifications(v):
|
|||
comments = comments[:100]
|
||||
elif messages:
|
||||
cids = v.notification_messages(page=page)
|
||||
next_exists = (len(cids) > 100)
|
||||
cids = cids[:100]
|
||||
next_exists = (len(cids) > 25)
|
||||
cids = cids[:25]
|
||||
comments = get_comments(cids, v=v)
|
||||
elif posts:
|
||||
notifications = v.notifications.join(Notification.comment).filter(Comment.author_id == AUTOJANNY_ACCOUNT).order_by(Notification.id.desc()).offset(25 * (page - 1)).all()
|
||||
|
|
Loading…
Reference in New Issue