forked from MarseyWorld/MarseyWorld
fix pinned child comments
parent
d9d017844a
commit
5032a9aec2
|
@ -172,11 +172,6 @@ def post_id(pid, anything=None, v=None, sub=None):
|
|||
|
||||
pinned = [c[0] for c in comments.filter(Comment.stickied != None).all()]
|
||||
|
||||
for x in pinned:
|
||||
if x.level > 1:
|
||||
pinned.remove(x)
|
||||
pinned.append(x.top_comment)
|
||||
|
||||
comments = comments.filter(Comment.level == 1, Comment.stickied == None)
|
||||
|
||||
comments = sort_comments(sort, comments)
|
||||
|
@ -187,11 +182,6 @@ def post_id(pid, anything=None, v=None, sub=None):
|
|||
else:
|
||||
pinned = g.db.query(Comment).filter(Comment.parent_submission == post.id, Comment.stickied != None).all()
|
||||
|
||||
for x in pinned:
|
||||
if x.level > 1:
|
||||
pinned.remove(x)
|
||||
pinned.append(x.top_comment)
|
||||
|
||||
comments = g.db.query(Comment).join(Comment.author).filter(User.shadowbanned == None, Comment.parent_submission == post.id, Comment.level == 1, Comment.stickied == None)
|
||||
|
||||
comments = sort_comments(sort, comments)
|
||||
|
@ -232,6 +222,11 @@ def post_id(pid, anything=None, v=None, sub=None):
|
|||
pin.stickied_utc = None
|
||||
g.db.add(pin)
|
||||
pinned.remove(pin)
|
||||
elif pin.level > 1:
|
||||
pinned.remove(pin)
|
||||
pinned.append(pin.top_comment)
|
||||
if pin.top_comment in comments:
|
||||
comments.remove(pin.top_comment)
|
||||
|
||||
post.replies = pinned + comments
|
||||
|
||||
|
|
Loading…
Reference in New Issue