fd
This commit is contained in:
parent
d0a41c9d7d
commit
549f28fb83
7 changed files with 23 additions and 23 deletions
|
@ -228,11 +228,11 @@ class Comment(Base, Age_times, Scores, Stndrd, Fuzzing):
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def is_blocking(self):
|
def is_blocking(self):
|
||||||
return self.__dict__.get('_is_blocking', 0)
|
return self.__dict__.get('is_blocking', 0)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def is_blocked(self):
|
def is_blocked(self):
|
||||||
return self.__dict__.get('_is_blocked', 0)
|
return self.__dict__.get('is_blocked', 0)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def body(self):
|
def body(self):
|
||||||
|
|
|
@ -386,11 +386,11 @@ class Submission(Base, Stndrd, Age_times, Scores, Fuzzing):
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def is_blocked(self):
|
def is_blocked(self):
|
||||||
return self.__dict__.get('_is_blocked', False)
|
return self.__dict__.get('is_blocked', False)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def is_blocking(self):
|
def is_blocking(self):
|
||||||
return self.__dict__.get('_is_blocking', False)
|
return self.__dict__.get('is_blocking', False)
|
||||||
|
|
||||||
#@property
|
#@property
|
||||||
#def award_count(self):
|
#def award_count(self):
|
||||||
|
|
|
@ -535,11 +535,11 @@ class User(Base, Stndrd, Age_times):
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def is_blocking(self):
|
def is_blocking(self):
|
||||||
return self.__dict__.get('_is_blocking', 0)
|
return self.__dict__.get('is_blocking', 0)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def is_blocked(self):
|
def is_blocked(self):
|
||||||
return self.__dict__.get('_is_blocked', 0)
|
return self.__dict__.get('is_blocked', 0)
|
||||||
|
|
||||||
def refresh_selfset_badges(self):
|
def refresh_selfset_badges(self):
|
||||||
|
|
||||||
|
|
|
@ -36,8 +36,8 @@ def get_user(username, v=None, graceful=False):
|
||||||
)
|
)
|
||||||
).first()
|
).first()
|
||||||
|
|
||||||
user._is_blocking = block and block.user_id == v.id
|
user.is_blocking = block and block.user_id == v.id
|
||||||
user._is_blocked = block and block.target_id == v.id
|
user.is_blocked = block and block.target_id == v.id
|
||||||
|
|
||||||
return user
|
return user
|
||||||
|
|
||||||
|
@ -64,8 +64,8 @@ def get_account(id, v=None):
|
||||||
)
|
)
|
||||||
).first()
|
).first()
|
||||||
|
|
||||||
user._is_blocking = block and block.user_id == v.id
|
user.is_blocking = block and block.user_id == v.id
|
||||||
user._is_blocked = block and block.target_id == v.id
|
user.is_blocked = block and block.target_id == v.id
|
||||||
|
|
||||||
return user
|
return user
|
||||||
|
|
||||||
|
@ -102,7 +102,7 @@ def get_post(i, v=None, graceful=False, **kwargs):
|
||||||
abort(404)
|
abort(404)
|
||||||
x = items[0]
|
x = items[0]
|
||||||
x.voted = items[1] or 0
|
x.voted = items[1] or 0
|
||||||
x._is_blocking = items[2] or 0
|
x.is_blocking = items[2] or 0
|
||||||
else:
|
else:
|
||||||
items = g.db.query(
|
items = g.db.query(
|
||||||
Submission
|
Submission
|
||||||
|
@ -152,8 +152,8 @@ def get_posts(pids, v=None):
|
||||||
output = [p[0] for p in query]
|
output = [p[0] for p in query]
|
||||||
for i in range(len(output)):
|
for i in range(len(output)):
|
||||||
output[i].voted = query[i][1] or 0
|
output[i].voted = query[i][1] or 0
|
||||||
output[i]._is_blocking = query[i][2] or 0
|
output[i].is_blocking = query[i][2] or 0
|
||||||
output[i]._is_blocked = query[i][3] or 0
|
output[i].is_blocked = query[i][3] or 0
|
||||||
else:
|
else:
|
||||||
output = g.db.query(Submission,).filter(Submission.id.in_(pids)).all()
|
output = g.db.query(Submission,).filter(Submission.id.in_(pids)).all()
|
||||||
|
|
||||||
|
@ -181,8 +181,8 @@ def get_comment(i, v=None, graceful=False, **kwargs):
|
||||||
|
|
||||||
vts = g.db.query(CommentVote).filter_by(user_id=v.id, comment_id=comment.id)
|
vts = g.db.query(CommentVote).filter_by(user_id=v.id, comment_id=comment.id)
|
||||||
vt = g.db.query(CommentVote).filter_by(user_id=v.id, comment_id=comment.id).first()
|
vt = g.db.query(CommentVote).filter_by(user_id=v.id, comment_id=comment.id).first()
|
||||||
comment._is_blocking = block and block.user_id == v.id
|
comment.is_blocking = block and block.user_id == v.id
|
||||||
comment._is_blocked = block and block.target_id == v.id
|
comment.is_blocked = block and block.target_id == v.id
|
||||||
comment.voted = vt.vote_type if vt else 0
|
comment.voted = vt.vote_type if vt else 0
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
@ -231,8 +231,8 @@ def get_comments(cids, v=None, load_parent=False):
|
||||||
comment = c[0]
|
comment = c[0]
|
||||||
if comment.author and comment.author.shadowbanned and not (v and v.id == comment.author_id): continue
|
if comment.author and comment.author.shadowbanned and not (v and v.id == comment.author_id): continue
|
||||||
comment.voted = c[1] or 0
|
comment.voted = c[1] or 0
|
||||||
comment._is_blocking = c[2] or 0
|
comment.is_blocking = c[2] or 0
|
||||||
comment._is_blocked = c[3] or 0
|
comment.is_blocked = c[3] or 0
|
||||||
output.append(comment)
|
output.append(comment)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -117,8 +117,8 @@ def post_pid_comment_cid(cid, pid=None, anything=None, v=None):
|
||||||
comment = c[0]
|
comment = c[0]
|
||||||
if comment.author and comment.author.shadowbanned and not (v and v.id == comment.author_id): continue
|
if comment.author and comment.author.shadowbanned and not (v and v.id == comment.author_id): continue
|
||||||
comment.voted = c[1] or 0
|
comment.voted = c[1] or 0
|
||||||
comment._is_blocking = c[2] or 0
|
comment.is_blocking = c[2] or 0
|
||||||
comment._is_blocked = c[3] or 0
|
comment.is_blocked = c[3] or 0
|
||||||
|
|
||||||
if request.headers.get("Authorization"): return top_comment.json
|
if request.headers.get("Authorization"): return top_comment.json
|
||||||
else: return post.rendered_page(v=v, sort=sort, comment=top_comment, comment_info=comment_info)
|
else: return post.rendered_page(v=v, sort=sort, comment=top_comment, comment_info=comment_info)
|
||||||
|
|
|
@ -67,8 +67,8 @@ def notifications(v):
|
||||||
|
|
||||||
listing = []
|
listing = []
|
||||||
for c in comments:
|
for c in comments:
|
||||||
c._is_blocked = False
|
c.is_blocked = False
|
||||||
c._is_blocking = False
|
c.is_blocking = False
|
||||||
if c.parent_submission and c.parent_comment and c.parent_comment.author_id == v.id:
|
if c.parent_submission and c.parent_comment and c.parent_comment.author_id == v.id:
|
||||||
c.replies = []
|
c.replies = []
|
||||||
while c.parent_comment and c.parent_comment.author_id == v.id:
|
while c.parent_comment and c.parent_comment.author_id == v.id:
|
||||||
|
|
|
@ -136,8 +136,8 @@ def post_id(pid, anything=None, v=None):
|
||||||
comment = c[0]
|
comment = c[0]
|
||||||
if comment.author and comment.author.shadowbanned and not (v and v.id == comment.author_id): continue
|
if comment.author and comment.author.shadowbanned and not (v and v.id == comment.author_id): continue
|
||||||
comment.voted = c[1] or 0
|
comment.voted = c[1] or 0
|
||||||
comment._is_blocking = c[2] or 0
|
comment.is_blocking = c[2] or 0
|
||||||
comment._is_blocked = c[3] or 0
|
comment.is_blocked = c[3] or 0
|
||||||
output.append(comment)
|
output.append(comment)
|
||||||
|
|
||||||
post.preloaded_comments = output
|
post.preloaded_comments = output
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue