dfs
This commit is contained in:
parent
96efdf55e9
commit
4b27cbad1c
6 changed files with 6 additions and 20 deletions
|
@ -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,
|
||||
|
|
|
@ -86,10 +86,7 @@ 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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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,
|
||||
|
@ -127,9 +123,6 @@ def post_id(pid, anything=None, v=None):
|
|||
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
|
||||
).join(
|
||||
|
|
|
@ -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")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue