master
Aevann1 2021-09-24 05:15:14 +02:00
parent cd827b6ce2
commit c79da04884
4 changed files with 5 additions and 11 deletions

View File

@ -372,8 +372,7 @@ class User(Base):
@property
@lazy
def post_notifications_count(self):
return self.notifications.filter(Notification.read == False).join(Notification.comment).filter(
Comment.author_id == AUTOJANNY_ACCOUNT).count()
return self.notifications.filter(Notification.read == False).join(Notification.comment).filter(Comment.author_id == AUTOJANNY_ACCOUNT).count()
@property
@lazy

View File

@ -287,7 +287,7 @@ def reported_posts(v):
posts = g.db.query(Submission).options(lazyload('*')).filter_by(
is_approved=0,
is_banned=False
).join(Submission.flags).order_by(Submission.id.desc()).offset(25 * (page - 1)).limit(26)
).order_by(Submission.id.desc()).offset(25 * (page - 1)).limit(26)
listing = [p.id for p in posts]
next_exists = (len(listing) > 25)
@ -309,7 +309,7 @@ def reported_comments(v):
).filter_by(
is_approved=0,
is_banned=False
).join(Comment.flags).order_by(Comment.id.desc()).offset(25 * (page - 1)).limit(26).all()
).order_by(Comment.id.desc()).offset(25 * (page - 1)).limit(26).all()
listing = [p.id for p in posts]
next_exists = (len(listing) > 25)

View File

@ -167,7 +167,7 @@ def frontlist(v=None, sort="hot", page=1, t="all", ids_only=True, filter_words='
posts = posts.filter(Submission.created_utc < lt)
if not (v and v.shadowbanned):
posts = posts.join(Submission.author).filter(User.shadowbanned == False)
posts = posts.join(Submission.author.shadowbanned).filter(User.shadowbanned == False)
if sort == "hot":
ti = int(time.time())
@ -256,7 +256,6 @@ def changeloglist(v=None, sort="new", page=1 ,t="all", **kwargs):
Submission.author_id.notin_(blocked)
)
posts=posts.join(Submission.author)
posts=posts.filter(Submission.title.ilike(f'_changelog%', User.admin_level == 6))
if t != 'all':

View File

@ -58,11 +58,7 @@ def searchposts(v):
posts = g.db.query(Submission).options(
lazyload('*')
).join(
Submission.author
)
posts = g.db.query(Submission).options(lazyload('*'))
if not (v and v.admin_level == 6): posts = posts.filter(Submission.private == False)