forked from rDrama/rDrama
fdfd
parent
26876ac01a
commit
1a59f95d5e
|
@ -567,12 +567,12 @@ class User(Base, Stndrd, Age_times):
|
||||||
posts = posts.filter(Submission.id.in_(saved))
|
posts = posts.filter(Submission.id.in_(saved))
|
||||||
|
|
||||||
if self.admin_level == 0:
|
if self.admin_level == 0:
|
||||||
blocking = g.db.query(
|
blocking = [x[0] for x in g.db.query(
|
||||||
UserBlock.target_id).filter_by(
|
UserBlock.target_id).filter_by(
|
||||||
user_id=self.id).all()
|
user_id=self.id).all()]
|
||||||
blocked = g.db.query(
|
blocked = [x[0] for x in g.db.query(
|
||||||
UserBlock.user_id).filter_by(
|
UserBlock.user_id).filter_by(
|
||||||
target_id=self.id).all()
|
target_id=self.id).all()]
|
||||||
|
|
||||||
posts = posts.filter(
|
posts = posts.filter(
|
||||||
Submission.author_id.notin_(blocking),
|
Submission.author_id.notin_(blocking),
|
||||||
|
@ -591,12 +591,12 @@ class User(Base, Stndrd, Age_times):
|
||||||
comments = comments.filter(Comment.id.in_(saved))
|
comments = comments.filter(Comment.id.in_(saved))
|
||||||
|
|
||||||
if self.admin_level == 0:
|
if self.admin_level == 0:
|
||||||
blocking = g.db.query(
|
blocking = [x[0] for x in g.db.query(
|
||||||
UserBlock.target_id).filter_by(
|
UserBlock.target_id).filter_by(
|
||||||
user_id=self.id).all()
|
user_id=self.id).all()]
|
||||||
blocked = g.db.query(
|
blocked = [x[0] for x in g.db.query(
|
||||||
UserBlock.user_id).filter_by(
|
UserBlock.user_id).filter_by(
|
||||||
target_id=self.id).all()
|
target_id=self.id).all()]
|
||||||
|
|
||||||
comments = comments.filter(
|
comments = comments.filter(
|
||||||
Comment.author_id.notin_(blocking),
|
Comment.author_id.notin_(blocking),
|
||||||
|
|
|
@ -136,12 +136,12 @@ def frontlist(v=None, sort="hot", page=1, t="all", ids_only=True, filter_words='
|
||||||
posts = posts.filter_by(processing=False)
|
posts = posts.filter_by(processing=False)
|
||||||
|
|
||||||
if v and v.admin_level == 0:
|
if v and v.admin_level == 0:
|
||||||
blocking = g.db.query(
|
blocking = [x[0] for x in g.db.query(
|
||||||
UserBlock.target_id).filter_by(
|
UserBlock.target_id).filter_by(
|
||||||
user_id=v.id).all()
|
user_id=v.id).all()]
|
||||||
blocked = g.db.query(
|
blocked = [x[0] for x in g.db.query(
|
||||||
UserBlock.user_id).filter_by(
|
UserBlock.user_id).filter_by(
|
||||||
target_id=v.id).all()
|
target_id=v.id).all()]
|
||||||
posts = posts.filter(
|
posts = posts.filter(
|
||||||
Submission.author_id.notin_(blocking),
|
Submission.author_id.notin_(blocking),
|
||||||
Submission.author_id.notin_(blocked)
|
Submission.author_id.notin_(blocked)
|
||||||
|
@ -268,12 +268,12 @@ def changeloglist(v=None, sort="new", page=1 ,t="all", **kwargs):
|
||||||
posts = g.db.query(Submission).options(lazyload('*')).options(lazyload('*')).filter_by(is_banned=False, private=False,).filter(Submission.deleted_utc == 0)
|
posts = g.db.query(Submission).options(lazyload('*')).options(lazyload('*')).filter_by(is_banned=False, private=False,).filter(Submission.deleted_utc == 0)
|
||||||
|
|
||||||
if v and v.admin_level == 0:
|
if v and v.admin_level == 0:
|
||||||
blocking = g.db.query(
|
blocking = [x[0] for x in g.db.query(
|
||||||
UserBlock.target_id).filter_by(
|
UserBlock.target_id).filter_by(
|
||||||
user_id=v.id).all()
|
user_id=v.id).all()]
|
||||||
blocked = g.db.query(
|
blocked = [x[0] for x in g.db.query(
|
||||||
UserBlock.user_id).filter_by(
|
UserBlock.user_id).filter_by(
|
||||||
target_id=v.id).all()
|
target_id=v.id).all()]
|
||||||
posts = posts.filter(
|
posts = posts.filter(
|
||||||
Submission.author_id.notin_(blocking),
|
Submission.author_id.notin_(blocking),
|
||||||
Submission.author_id.notin_(blocked)
|
Submission.author_id.notin_(blocked)
|
||||||
|
@ -378,19 +378,19 @@ def random_post(v):
|
||||||
def comment_idlist(page=1, v=None, nsfw=False, sort="new", t="all", **kwargs):
|
def comment_idlist(page=1, v=None, nsfw=False, sort="new", t="all", **kwargs):
|
||||||
|
|
||||||
posts = g.db.query(Submission).options(lazyload('*'))
|
posts = g.db.query(Submission).options(lazyload('*'))
|
||||||
cc_idlist = g.db.query(Submission.id).options(lazyload('*')).filter(Submission.club == True).all()
|
cc_idlist = [x[0] for x in g.db.query(Submission.id).options(lazyload('*')).filter(Submission.club == True).all()]
|
||||||
|
|
||||||
posts = posts.subquery()
|
posts = posts.subquery()
|
||||||
|
|
||||||
comments = g.db.query(Comment).options(lazyload('*')).options(lazyload('*')).filter(Comment.parent_submission.notin_(cc_idlist))
|
comments = g.db.query(Comment).options(lazyload('*')).options(lazyload('*')).filter(Comment.parent_submission.notin_(cc_idlist))
|
||||||
|
|
||||||
if v and v.admin_level <= 3:
|
if v and v.admin_level <= 3:
|
||||||
blocking = g.db.query(
|
blocking = [x[0] for x in g.db.query(
|
||||||
UserBlock.target_id).filter_by(
|
UserBlock.target_id).filter_by(
|
||||||
user_id=v.id).all()
|
user_id=v.id).all()]
|
||||||
blocked = g.db.query(
|
blocked = [x[0] for x in g.db.query(
|
||||||
UserBlock.user_id).filter_by(
|
UserBlock.user_id).filter_by(
|
||||||
target_id=v.id).all()
|
target_id=v.id).all()]
|
||||||
|
|
||||||
comments = comments.filter(
|
comments = comments.filter(
|
||||||
Comment.author_id.notin_(blocking),
|
Comment.author_id.notin_(blocking),
|
||||||
|
|
|
@ -110,7 +110,7 @@ def post_id(pid, anything=None, v=None):
|
||||||
blocked = v.blocked.subquery()
|
blocked = v.blocked.subquery()
|
||||||
|
|
||||||
if not (v and v.shadowbanned) and not (v and v.admin_level == 6):
|
if not (v and v.shadowbanned) and not (v and v.admin_level == 6):
|
||||||
shadowbanned = g.db.query(User.id).options(lazyload('*')).filter(User.shadowbanned == True).all()
|
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).options(lazyload('*')).filter(Comment.author_id.notin_(shadowbanned))
|
||||||
|
|
||||||
comments = g.db.query(
|
comments = g.db.query(
|
||||||
|
@ -121,7 +121,7 @@ def post_id(pid, anything=None, v=None):
|
||||||
)
|
)
|
||||||
|
|
||||||
if not (v and v.shadowbanned) and not (v and v.admin_level == 6):
|
if not (v and v.shadowbanned) and not (v and v.admin_level == 6):
|
||||||
shadowbanned = g.db.query(User.id).options(lazyload('*')).filter(User.shadowbanned == True).all()
|
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))
|
comments = comments.filter(Comment.author_id.notin_(shadowbanned))
|
||||||
|
|
||||||
if v.admin_level >=4:
|
if v.admin_level >=4:
|
||||||
|
@ -170,7 +170,7 @@ def post_id(pid, anything=None, v=None):
|
||||||
post.preloaded_comments = output
|
post.preloaded_comments = output
|
||||||
|
|
||||||
else:
|
else:
|
||||||
shadowbanned = g.db.query(User.id).options(lazyload('*')).filter(User.shadowbanned == True).all()
|
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.parent_submission == post.id, Comment.author_id.notin_(shadowbanned))
|
comments = g.db.query(Comment).options(lazyload('*')).filter(Comment.parent_submission == post.id, Comment.author_id.notin_(shadowbanned))
|
||||||
|
|
||||||
if sort == "top":
|
if sort == "top":
|
||||||
|
|
|
@ -88,12 +88,12 @@ def searchlisting(criteria, v=None, page=1, t="None", sort="top", b=None):
|
||||||
if v and v.admin_level >= 4:
|
if v and v.admin_level >= 4:
|
||||||
pass
|
pass
|
||||||
elif v:
|
elif v:
|
||||||
blocking = g.db.query(
|
blocking = [x[0] for x in g.db.query(
|
||||||
UserBlock.target_id).filter_by(
|
UserBlock.target_id).filter_by(
|
||||||
user_id=v.id).all()
|
user_id=v.id).all()]
|
||||||
blocked = g.db.query(
|
blocked = [x[0] for x in g.db.query(
|
||||||
UserBlock.user_id).filter_by(
|
UserBlock.user_id).filter_by(
|
||||||
target_id=v.id).all()
|
target_id=v.id).all()]
|
||||||
|
|
||||||
posts = posts.filter(
|
posts = posts.filter(
|
||||||
Submission.author_id.notin_(blocking),
|
Submission.author_id.notin_(blocking),
|
||||||
|
|
Loading…
Reference in New Issue