forked from rDrama/rDrama
fix comments not appearing
parent
8342e8b7c3
commit
86b0d2f5c1
|
@ -291,7 +291,7 @@ def add_vote_and_block_props(target:Union[Submission, Comment], v:Optional[User]
|
|||
def get_comments(cids:Iterable[int], v:Optional[User]=None, extra:Optional[Callable[[Query], Query]]=None) -> List[Comment]:
|
||||
if not cids: return []
|
||||
if v:
|
||||
output = get_comments_v_properties(v, True, None, Comment.id.in_(cids))[1] # TODO: support 'extra' for get_comments_v_properties
|
||||
output = get_comments_v_properties(v, None, Comment.id.in_(cids))[1]
|
||||
else:
|
||||
output = g.db.query(Comment).join(Comment.author)
|
||||
if extra: output = extra(output)
|
||||
|
|
|
@ -70,7 +70,7 @@ def post_pid_comment_cid(cid, pid=None, anything=None, v=None, sub=None):
|
|||
if v:
|
||||
# this is required because otherwise the vote and block
|
||||
# props won't save properly unless you put them in a list
|
||||
output = get_comments_v_properties(v, False, None, Comment.top_comment_id == c.top_comment_id)[1]
|
||||
output = get_comments_v_properties(v, None, Comment.top_comment_id == c.top_comment_id)[1]
|
||||
post.replies=[top_comment]
|
||||
|
||||
execute_shadowban_viewers_and_voters(v, post)
|
||||
|
|
|
@ -369,7 +369,7 @@ def notifications(v:User):
|
|||
total_cids = [x.id for x in total]
|
||||
total_cids.extend(cids)
|
||||
total_cids = set(total_cids)
|
||||
output = get_comments_v_properties(v, True, None, Comment.id.in_(total_cids))[1]
|
||||
output = get_comments_v_properties(v, None, Comment.id.in_(total_cids))[1]
|
||||
|
||||
g.db.commit()
|
||||
|
||||
|
|
|
@ -101,7 +101,7 @@ def post_id(pid, anything=None, v=None, sub=None):
|
|||
execute_shadowban_viewers_and_voters(v, post)
|
||||
# shadowban check is done in sort_objects
|
||||
# output is needed: see comments.py
|
||||
comments, output = get_comments_v_properties(v, True, None, Comment.parent_submission == post.id, Comment.level < 10)
|
||||
comments, output = get_comments_v_properties(v, None, Comment.parent_submission == post.id, Comment.level < 10)
|
||||
pinned = [c[0] for c in comments.filter(Comment.stickied != None).order_by(Comment.created_utc.desc()).all()]
|
||||
comments = comments.filter(Comment.level == 1, Comment.stickied == None)
|
||||
comments = sort_objects(sort, comments, Comment)
|
||||
|
@ -188,7 +188,7 @@ def view_more(v, pid, sort, offset):
|
|||
if v:
|
||||
# shadowban check is done in sort_objects
|
||||
# output is needed: see comments.py
|
||||
comments, output = get_comments_v_properties(v, True, None, Comment.parent_submission == pid, Comment.stickied == None, Comment.id.notin_(ids), Comment.level < 10)
|
||||
comments, output = get_comments_v_properties(v, None, Comment.parent_submission == pid, Comment.stickied == None, Comment.id.notin_(ids), Comment.level < 10)
|
||||
comments = comments.filter(Comment.level == 1)
|
||||
comments = sort_objects(sort, comments, Comment)
|
||||
|
||||
|
@ -239,7 +239,7 @@ def more_comments(v, cid):
|
|||
if v:
|
||||
# shadowban check is done in sort_objects i think
|
||||
# output is needed: see comments.py
|
||||
comments, output = get_comments_v_properties(v, True, None, Comment.top_comment_id == tcid, Comment.level > 9)
|
||||
comments, output = get_comments_v_properties(v, None, Comment.top_comment_id == tcid, Comment.level > 9)
|
||||
comments = comments.filter(Comment.parent_comment_id == cid)
|
||||
comments = [c[0] for c in comments.all()]
|
||||
else:
|
||||
|
|
|
@ -820,7 +820,7 @@ def u_username_wall(v:Optional[User], username:str):
|
|||
except: page = 1
|
||||
|
||||
if v:
|
||||
comments, output = get_comments_v_properties(v, True, None, Comment.wall_user_id == u.id)
|
||||
comments, output = get_comments_v_properties(v, None, Comment.wall_user_id == u.id)
|
||||
else:
|
||||
comments = g.db.query(Comment).filter(Comment.wall_user_id == u.id)
|
||||
comments = comments.filter(Comment.level == 1)
|
||||
|
@ -891,7 +891,7 @@ def u_username_wall_comment(v:User, username:str, cid):
|
|||
if v:
|
||||
# this is required because otherwise the vote and block
|
||||
# props won't save properly unless you put them in a list
|
||||
output = get_comments_v_properties(v, False, None, Comment.top_comment_id == c.top_comment_id)[1]
|
||||
output = get_comments_v_properties(v, None, Comment.top_comment_id == c.top_comment_id)[1]
|
||||
|
||||
if v and v.client: return top_comment.json(db=g.db)
|
||||
|
||||
|
|
Loading…
Reference in New Issue