sort posts with "megathread" in title by new cuz ppl forget to tick the "new" checkbox

master
Aevann1 2022-08-30 20:22:15 +02:00
parent 2871d9ad91
commit bcec360f30
1 changed files with 2 additions and 2 deletions

View File

@ -124,7 +124,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: defaultsortingcomments = 'new' if post.new or 'megathread' 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)
@ -1071,7 +1071,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: sort = 'new' if post.new or 'megathread' 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)