fd
This commit is contained in:
parent
937a68f8a2
commit
b2bfcb5e90
2 changed files with 4 additions and 9 deletions
|
@ -75,11 +75,6 @@ def post_pid_comment_cid(cid, pid=None, anything=None, v=None):
|
||||||
|
|
||||||
current_ids = [comment.id]
|
current_ids = [comment.id]
|
||||||
|
|
||||||
exile=g.db.query(ModAction
|
|
||||||
).filter_by(
|
|
||||||
kind="exile_user"
|
|
||||||
).distinct(ModAction.target_comment_id).subquery()
|
|
||||||
|
|
||||||
for i in range(6 - context):
|
for i in range(6 - context):
|
||||||
if v:
|
if v:
|
||||||
blocking = v.blocking.subquery()
|
blocking = v.blocking.subquery()
|
||||||
|
@ -103,15 +98,15 @@ def post_pid_comment_cid(cid, pid=None, anything=None, v=None):
|
||||||
)
|
)
|
||||||
|
|
||||||
if sort == "top":
|
if sort == "top":
|
||||||
comments = sorted(comments.all(), key=lambda x: x.score, reverse=True)
|
comments = sorted(comments.all(), key=lambda x: x[0].score, reverse=True)
|
||||||
elif sort == "bottom":
|
elif sort == "bottom":
|
||||||
comments = sorted(comments.all(), key=lambda x: x.score)
|
comments = sorted(comments.all(), key=lambda x: x[0].score)
|
||||||
elif sort == "new":
|
elif sort == "new":
|
||||||
comments = comments.order_by(Comment.created_utc.desc()).all()
|
comments = comments.order_by(Comment.created_utc.desc()).all()
|
||||||
elif sort == "old":
|
elif sort == "old":
|
||||||
comments = comments.order_by(Comment.created_utc.asc()).all()
|
comments = comments.order_by(Comment.created_utc.asc()).all()
|
||||||
elif sort == "controversial":
|
elif sort == "controversial":
|
||||||
comments = sorted(comments.all(), key=lambda x: x.score_disputed, reverse=True)
|
comments = sorted(comments.all(), key=lambda x: x[0].score_disputed, reverse=True)
|
||||||
elif sort == "random":
|
elif sort == "random":
|
||||||
c = comments.all()
|
c = comments.all()
|
||||||
comments = random.sample(c, k=len(c))
|
comments = random.sample(c, k=len(c))
|
||||||
|
|
|
@ -323,7 +323,7 @@ def changelog(v):
|
||||||
def random_post(v):
|
def random_post(v):
|
||||||
if v and v.is_banned and not v.unban_utc: return render_template("seized.html")
|
if v and v.is_banned and not v.unban_utc: return render_template("seized.html")
|
||||||
|
|
||||||
x = g.db.query(Submission).filter(Submission.deleted_utc == 0, Submission.is_banned == False, Submission.score > 20)
|
x = g.db.query(Submission).filter(Submission.deleted_utc == 0, Submission.is_banned == False)
|
||||||
|
|
||||||
total = x.count()
|
total = x.count()
|
||||||
n = random.randint(0, total - 1)
|
n = random.randint(0, total - 1)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue