This commit is contained in:
Aevann1 2021-09-01 18:26:02 +02:00
parent d8c14fb713
commit 3355870810
2 changed files with 7 additions and 15 deletions

View file

@ -353,19 +353,9 @@ class User(Base, Stndrd, Age_times):
return self.notifications.filter(Notification.read == False).join(Notification.comment).filter(
Comment.author_id == AUTOJANNY_ACCOUNT).count()
def notification_modmail(self, page=1):
comments = g.db.query(Comment).filter(Comment.sentto==0).filter(Comment.parent_submission == None).order_by(Comment.created_utc.desc()).all()
comments = [c.id for c in comments if c.child_comments == []]
firstrange = 25 * (page - 1)
secondrange = firstrange + 26
return comments[firstrange:secondrange]
@cache.memoize(timeout=86400)
def notification_messages(self, page=1):
comments = g.db.query(Comment).filter(or_(Comment.author_id==self.id, Comment.sentto==self.id)).filter(Comment.parent_submission == None).order_by(Comment.created_utc.desc()).limit(100).all()
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()).limit(100).all()
comments = [c.id for c in comments if c.child_comments == []]