remotes/1693045480750635534/spooky-22
Aevann1 2021-09-28 21:45:17 +02:00
parent c85fd05a47
commit 79e6356b29
6 changed files with 6 additions and 20 deletions

View File

@ -1,6 +1,5 @@
from files.classes import *
from flask import g
from sqlalchemy.orm import joinedload
def get_user(username, v=None, graceful=False):
@ -83,8 +82,6 @@ def get_post(i, v=None, graceful=False, **kwargs):
blocking.c.id,
)
if v.admin_level>=4:
items=items.options(joinedload(Submission.oauth_app))
items=items.filter(Submission.id == i
).join(
vt,
@ -214,7 +211,7 @@ def get_comments(cids, v=None, load_parent=False):
if not (v and v.shadowbanned) and not (v and v.admin_level == 6):
shadowbanned = [x[0] for x in g.db.query(User.id).options(lazyload('*')).filter(User.shadowbanned == True).all()]
comments = g.db.query(Comment).options(lazyload('*')).filter(Comment.author_id.notin_(shadowbanned))
comments = comments.filter(Comment.author_id.notin_(shadowbanned))
comments = comments.join(
votes,

View File

@ -86,11 +86,8 @@ def post_pid_comment_cid(cid, pid=None, anything=None, v=None):
if not (v and v.shadowbanned) and not (v and v.admin_level == 6):
shadowbanned = [x[0] for x in g.db.query(User.id).options(lazyload('*')).filter(User.shadowbanned == True).all()]
comments = g.db.query(Comment).options(lazyload('*')).filter(Comment.author_id.notin_(shadowbanned))
if v.admin_level >=4:
comments=comments.options(joinedload(Comment.oauth_app))
comments = comments.filter(Comment.author_id.notin_(shadowbanned))
comments=comments.filter(
Comment.parent_submission == post.id
).join(

View File

@ -193,12 +193,9 @@ def frontlist(v=None, sort="hot", page=1, t="all", ids_only=True, filter_words='
for word in filter_words:
posts=posts.filter(not_(Submission.title.ilike(f'%{word}%')))
gt = kwargs.get("gt")
lt = kwargs.get("lt")
if not (v and v.shadowbanned):
shadowbanned = [x[0] for x in g.db.query(User.id).options(lazyload('*')).filter(User.shadowbanned == True).all()]
posts = g.db.query(Submission).options(lazyload('*')).filter(Submission.author_id.notin_(shadowbanned))
posts = posts.filter(Submission.author_id.notin_(shadowbanned))
if sort == "hot":
ti = int(time.time()) + 3600

View File

@ -5,6 +5,7 @@ from files.helpers.const import *
from files.classes import *
from flask import *
from files.__main__ import app
from sqlalchemy.orm import joinedload
@app.get("/authorize")
@auth_required

View File

@ -112,10 +112,6 @@ def post_id(pid, anything=None, v=None):
blocked = v.blocked.subquery()
if not (v and v.shadowbanned) and not (v and v.admin_level == 6):
shadowbanned = [x[0] for x in g.db.query(User.id).options(lazyload('*')).filter(User.shadowbanned == True).all()]
comments = g.db.query(Comment).options(lazyload('*')).filter(Comment.author_id.notin_(shadowbanned))
comments = g.db.query(
Comment,
votes.c.vote_type,
@ -126,9 +122,6 @@ def post_id(pid, anything=None, v=None):
if not (v and v.shadowbanned) and not (v and v.admin_level == 6):
shadowbanned = [x[0] for x in g.db.query(User.id).options(lazyload('*')).filter(User.shadowbanned == True).all()]
comments = comments.filter(Comment.author_id.notin_(shadowbanned))
if v.admin_level >=4:
comments=comments.options(joinedload(Comment.oauth_app))
comments=comments.filter(
Comment.parent_submission == post.id

View File

@ -3,6 +3,7 @@ from files.helpers.get import *
from files.classes import *
from flask import *
from files.__main__ import app
from sqlalchemy.orm import joinedload
@app.get("/votes")