From 78286a4d5e3f5f4a30c732a426bb4027020d538b Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Wed, 1 Sep 2021 18:16:31 +0200 Subject: [PATCH] fggf --- files/classes/user.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/files/classes/user.py b/files/classes/user.py index 504eb2d3f..f982d1f71 100644 --- a/files/classes/user.py +++ b/files/classes/user.py @@ -353,11 +353,19 @@ 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(or_(Comment.author_id==self.id, Comment.sentto==self.id, Comment.sentto==0)).filter(Comment.parent_submission == None).order_by(Comment.created_utc.desc()).limit(100).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): - - if self.admin_level == 6: comments = g.db.query(Comment).filter(or_(Comment.author_id==self.id, Comment.sentto==self.id, Comment.sentto==0)).filter(Comment.parent_submission == None).order_by(Comment.created_utc.desc()).limit(100).all() - else: 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)).filter(Comment.parent_submission == None).order_by(Comment.created_utc.desc()).limit(100).all() comments = [c.id for c in comments if c.child_comments == []]