make it whenever a post has "thread" (instead of "megathread") in the title, the comments are ordered by new

master
Aevann1 2022-06-25 21:55:29 +02:00
parent 7a402d2449
commit af680d8a94
1 changed files with 2 additions and 2 deletions

View File

@ -141,7 +141,7 @@ def post_id(pid, anything=None, v=None, sub=None):
if request.headers.get("Authorization") or request.headers.get("xhr"): return {"error":"Must be 18+ to view"}, 451 if request.headers.get("Authorization") or request.headers.get("xhr"): return {"error":"Must be 18+ to view"}, 451
return render_template("errors/nsfw.html", v=v) return render_template("errors/nsfw.html", v=v)
if post.new or 'megathread' in post.title.lower(): defaultsortingcomments = 'new' if post.new or 'thread' in post.title.lower(): defaultsortingcomments = 'new'
elif v: defaultsortingcomments = v.defaultsortingcomments elif v: defaultsortingcomments = v.defaultsortingcomments
else: defaultsortingcomments = "top" else: defaultsortingcomments = "top"
sort = request.values.get("sort", defaultsortingcomments) sort = request.values.get("sort", defaultsortingcomments)
@ -1226,7 +1226,7 @@ def submit_post(v, sub=None):
if request.headers.get("Authorization"): return post.json if request.headers.get("Authorization"): return post.json
else: else:
post.voted = 1 post.voted = 1
if post.new or 'megathread' in post.title.lower(): sort = 'new' if post.new or 'thread' in post.title.lower(): sort = 'new'
else: sort = v.defaultsortingcomments else: sort = v.defaultsortingcomments
return render_template('submission.html', v=v, p=post, sort=sort, render_replies=True, offset=0, success=True, sub=post.subr) return render_template('submission.html', v=v, p=post, sort=sort, render_replies=True, offset=0, success=True, sub=post.subr)