diff --git a/files/classes/submission.py b/files/classes/submission.py index c761cea39f..e89dc1f5d5 100644 --- a/files/classes/submission.py +++ b/files/classes/submission.py @@ -51,6 +51,7 @@ class Submission(Base): flair = Column(String) ban_reason = Column(String) embed_url = Column(String) + new = Column(Boolean) author = relationship("User", primaryjoin="Submission.author_id==User.id") oauth_app = relationship("OauthApp", viewonly=True) diff --git a/files/routes/posts.py b/files/routes/posts.py index 56f111e9f3..4bf9130f4b 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -159,7 +159,7 @@ def post_id(pid, anything=None, v=None, sub=None): post = get_post(pid, v=v) - if 'megathread' in post.title.lower(): defaultsortingcomments = 'new' + if post.new: defaultsortingcomments = 'new' elif v: defaultsortingcomments = v.defaultsortingcomments else: defaultsortingcomments = "top" sort = request.values.get("sort", defaultsortingcomments) @@ -1093,6 +1093,7 @@ def submit_post(v, sub=None): club=club, author_id=v.id, over_18=bool(request.values.get("over_18","")), + new=bool(request.values.get("new","")), app_id=v.client.application.id if v.client else None, is_bot = request.headers.get("Authorization"), url=url, @@ -1389,7 +1390,7 @@ def submit_post(v, sub=None): if request.headers.get("Authorization"): return post.json else: post.voted = 1 - if 'megathread' in post.title.lower(): sort = 'new' + if post.new: sort = 'new' 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) diff --git a/files/templates/submit.html b/files/templates/submit.html index 2216fda091..eaa36b743a 100644 --- a/files/templates/submit.html +++ b/files/templates/submit.html @@ -165,6 +165,11 @@ +