forked from rDrama/rDrama
fdfd
parent
2dce325a5a
commit
3939bc2436
|
@ -353,8 +353,8 @@ class User(Base, Stndrd, Age_times):
|
||||||
|
|
||||||
awards = {}
|
awards = {}
|
||||||
|
|
||||||
posts_idlist = g.db.query(Submission.id).options(lazyload('*')).filter_by(author_id=self.id).subquery()
|
posts_idlist = g.db.query(Submission.id).options(lazyload('*')).filter_by(author_id=self.id).all()
|
||||||
comments_idlist = g.db.query(Comment.id).options(lazyload('*')).filter_by(author_id=self.id).subquery()
|
comments_idlist = g.db.query(Comment.id).options(lazyload('*')).filter_by(author_id=self.id).all()
|
||||||
|
|
||||||
post_awards = g.db.query(AwardRelationship).options(lazyload('*')).filter(AwardRelationship.submission_id.in_(posts_idlist)).all()
|
post_awards = g.db.query(AwardRelationship).options(lazyload('*')).filter(AwardRelationship.submission_id.in_(posts_idlist)).all()
|
||||||
comment_awards = g.db.query(AwardRelationship).options(lazyload('*')).filter(AwardRelationship.comment_id.in_(comments_idlist)).all()
|
comment_awards = g.db.query(AwardRelationship).options(lazyload('*')).filter(AwardRelationship.comment_id.in_(comments_idlist)).all()
|
||||||
|
@ -393,7 +393,7 @@ class User(Base, Stndrd, Age_times):
|
||||||
Alt.user1 == self.id,
|
Alt.user1 == self.id,
|
||||||
Alt.user2 == self.id
|
Alt.user2 == self.id
|
||||||
)
|
)
|
||||||
).subquery()
|
).all()
|
||||||
|
|
||||||
data = g.db.query(
|
data = g.db.query(
|
||||||
User,
|
User,
|
||||||
|
@ -424,7 +424,7 @@ class User(Base, Stndrd, Age_times):
|
||||||
Alt.user1 == self.id,
|
Alt.user1 == self.id,
|
||||||
Alt.user2 == self.id
|
Alt.user2 == self.id
|
||||||
)
|
)
|
||||||
).subquery()
|
).all()
|
||||||
|
|
||||||
data = db.query(
|
data = db.query(
|
||||||
User,
|
User,
|
||||||
|
@ -563,16 +563,16 @@ class User(Base, Stndrd, Age_times):
|
||||||
deleted_utc=0
|
deleted_utc=0
|
||||||
)
|
)
|
||||||
|
|
||||||
saved = g.db.query(SaveRelationship.submission_id).options(lazyload('*')).filter(SaveRelationship.user_id == self.id).subquery()
|
saved = g.db.query(SaveRelationship.submission_id).options(lazyload('*')).filter(SaveRelationship.user_id == self.id).all()
|
||||||
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 = g.db.query(
|
||||||
UserBlock.target_id).filter_by(
|
UserBlock.target_id).filter_by(
|
||||||
user_id=self.id).subquery()
|
user_id=self.id).all()
|
||||||
blocked = g.db.query(
|
blocked = g.db.query(
|
||||||
UserBlock.user_id).filter_by(
|
UserBlock.user_id).filter_by(
|
||||||
target_id=self.id).subquery()
|
target_id=self.id).all()
|
||||||
|
|
||||||
posts = posts.filter(
|
posts = posts.filter(
|
||||||
Submission.author_id.notin_(blocking),
|
Submission.author_id.notin_(blocking),
|
||||||
|
@ -587,16 +587,16 @@ class User(Base, Stndrd, Age_times):
|
||||||
|
|
||||||
comments = g.db.query(Comment.id).options(lazyload('*')).options(lazyload('*')).filter_by(is_banned=False, deleted_utc=0)
|
comments = g.db.query(Comment.id).options(lazyload('*')).options(lazyload('*')).filter_by(is_banned=False, deleted_utc=0)
|
||||||
|
|
||||||
saved = g.db.query(SaveRelationship.submission_id).options(lazyload('*')).filter(SaveRelationship.user_id == self.id).subquery()
|
saved = g.db.query(SaveRelationship.submission_id).options(lazyload('*')).filter(SaveRelationship.user_id == self.id).all()
|
||||||
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 = g.db.query(
|
||||||
UserBlock.target_id).filter_by(
|
UserBlock.target_id).filter_by(
|
||||||
user_id=self.id).subquery()
|
user_id=self.id).all()
|
||||||
blocked = g.db.query(
|
blocked = g.db.query(
|
||||||
UserBlock.user_id).filter_by(
|
UserBlock.user_id).filter_by(
|
||||||
target_id=self.id).subquery()
|
target_id=self.id).all()
|
||||||
|
|
||||||
comments = comments.filter(
|
comments = comments.filter(
|
||||||
Comment.author_id.notin_(blocking),
|
Comment.author_id.notin_(blocking),
|
||||||
|
|
|
@ -74,8 +74,8 @@ def get_post(i, v=None, graceful=False, **kwargs):
|
||||||
|
|
||||||
if v:
|
if v:
|
||||||
vt = g.db.query(Vote).options(lazyload('*')).filter_by(
|
vt = g.db.query(Vote).options(lazyload('*')).filter_by(
|
||||||
user_id=v.id, submission_id=i).subquery()
|
user_id=v.id, submission_id=i).all()
|
||||||
blocking = v.blocking.subquery()
|
blocking = v.blocking.all()
|
||||||
|
|
||||||
items = g.db.query(
|
items = g.db.query(
|
||||||
Submission,
|
Submission,
|
||||||
|
@ -125,10 +125,10 @@ def get_posts(pids, v=None):
|
||||||
vt = g.db.query(Vote).options(lazyload('*')).filter(
|
vt = g.db.query(Vote).options(lazyload('*')).filter(
|
||||||
Vote.submission_id.in_(pids),
|
Vote.submission_id.in_(pids),
|
||||||
Vote.user_id==v.id
|
Vote.user_id==v.id
|
||||||
).subquery()
|
).all()
|
||||||
|
|
||||||
blocking = v.blocking.subquery()
|
blocking = v.blocking.all()
|
||||||
blocked = v.blocked.subquery()
|
blocked = v.blocked.all()
|
||||||
|
|
||||||
query = g.db.query(
|
query = g.db.query(
|
||||||
Submission,
|
Submission,
|
||||||
|
@ -199,11 +199,11 @@ def get_comments(cids, v=None, load_parent=False):
|
||||||
cids=tuple(cids)
|
cids=tuple(cids)
|
||||||
|
|
||||||
if v:
|
if v:
|
||||||
votes = g.db.query(CommentVote).options(lazyload('*')).filter_by(user_id=v.id).subquery()
|
votes = g.db.query(CommentVote).options(lazyload('*')).filter_by(user_id=v.id).all()
|
||||||
|
|
||||||
blocking = v.blocking.subquery()
|
blocking = v.blocking.all()
|
||||||
|
|
||||||
blocked = v.blocked.subquery()
|
blocked = v.blocked.all()
|
||||||
|
|
||||||
comments = g.db.query(
|
comments = g.db.query(
|
||||||
Comment,
|
Comment,
|
||||||
|
|
|
@ -82,11 +82,11 @@ def post_pid_comment_cid(cid, pid=None, anything=None, v=None):
|
||||||
post.replies=[top_comment]
|
post.replies=[top_comment]
|
||||||
|
|
||||||
if v:
|
if v:
|
||||||
votes = g.db.query(CommentVote).options(lazyload('*')).filter_by(user_id=v.id).subquery()
|
votes = g.db.query(CommentVote).options(lazyload('*')).filter_by(user_id=v.id).all()
|
||||||
|
|
||||||
blocking = v.blocking.subquery()
|
blocking = v.blocking.all()
|
||||||
|
|
||||||
blocked = v.blocked.subquery()
|
blocked = v.blocked.all()
|
||||||
|
|
||||||
comments = g.db.query(
|
comments = g.db.query(
|
||||||
Comment,
|
Comment,
|
||||||
|
|
|
@ -138,10 +138,10 @@ def frontlist(v=None, sort="hot", page=1, t="all", ids_only=True, filter_words='
|
||||||
if v and v.admin_level == 0:
|
if v and v.admin_level == 0:
|
||||||
blocking = g.db.query(
|
blocking = g.db.query(
|
||||||
UserBlock.target_id).filter_by(
|
UserBlock.target_id).filter_by(
|
||||||
user_id=v.id).subquery()
|
user_id=v.id).all()()
|
||||||
blocked = g.db.query(
|
blocked = g.db.query(
|
||||||
UserBlock.user_id).filter_by(
|
UserBlock.user_id).filter_by(
|
||||||
target_id=v.id).subquery()
|
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)
|
||||||
|
@ -270,10 +270,10 @@ def changeloglist(v=None, sort="new", page=1 ,t="all", **kwargs):
|
||||||
if v and v.admin_level == 0:
|
if v and v.admin_level == 0:
|
||||||
blocking = g.db.query(
|
blocking = g.db.query(
|
||||||
UserBlock.target_id).filter_by(
|
UserBlock.target_id).filter_by(
|
||||||
user_id=v.id).subquery()
|
user_id=v.id).all()
|
||||||
blocked = g.db.query(
|
blocked = g.db.query(
|
||||||
UserBlock.user_id).filter_by(
|
UserBlock.user_id).filter_by(
|
||||||
target_id=v.id).subquery()
|
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).subquery()
|
cc_idlist = g.db.query(Submission.id).options(lazyload('*')).filter(Submission.club == True).all()
|
||||||
|
|
||||||
posts = posts.subquery()
|
posts = posts.all()
|
||||||
|
|
||||||
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 = g.db.query(
|
||||||
UserBlock.target_id).filter_by(
|
UserBlock.target_id).filter_by(
|
||||||
user_id=v.id).subquery()
|
user_id=v.id).all()
|
||||||
blocked = g.db.query(
|
blocked = g.db.query(
|
||||||
UserBlock.user_id).filter_by(
|
UserBlock.user_id).filter_by(
|
||||||
target_id=v.id).subquery()
|
target_id=v.id).all()
|
||||||
|
|
||||||
comments = comments.filter(
|
comments = comments.filter(
|
||||||
Comment.author_id.notin_(blocking),
|
Comment.author_id.notin_(blocking),
|
||||||
|
|
|
@ -103,14 +103,14 @@ def post_id(pid, anything=None, v=None):
|
||||||
if post.club and not (v and v.paid_dues): abort(403)
|
if post.club and not (v and v.paid_dues): abort(403)
|
||||||
|
|
||||||
if v:
|
if v:
|
||||||
votes = g.db.query(CommentVote).options(lazyload('*')).filter_by(user_id=v.id).subquery()
|
votes = g.db.query(CommentVote).options(lazyload('*')).filter_by(user_id=v.id).all()
|
||||||
|
|
||||||
blocking = v.blocking.subquery()
|
blocking = v.blocking.all()
|
||||||
|
|
||||||
blocked = v.blocked.subquery()
|
blocked = v.blocked.all()
|
||||||
|
|
||||||
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).subquery()
|
shadowbanned = 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).subquery()
|
shadowbanned = 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).subquery()
|
shadowbanned = 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))
|
||||||
|
|
||||||
|
|
|
@ -90,10 +90,10 @@ def searchlisting(criteria, v=None, page=1, t="None", sort="top", b=None):
|
||||||
elif v:
|
elif v:
|
||||||
blocking = g.db.query(
|
blocking = g.db.query(
|
||||||
UserBlock.target_id).filter_by(
|
UserBlock.target_id).filter_by(
|
||||||
user_id=v.id).subquery()
|
user_id=v.id).all()()
|
||||||
blocked = g.db.query(
|
blocked = g.db.query(
|
||||||
UserBlock.user_id).filter_by(
|
UserBlock.user_id).filter_by(
|
||||||
target_id=v.id).subquery()
|
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