forked from rDrama/rDrama
1
0
Fork 0
master
Aevann1 2022-02-28 00:49:34 +02:00
parent ac0932986a
commit 2f35bce111
3 changed files with 9 additions and 2 deletions

View File

@ -51,6 +51,7 @@ class Submission(Base):
flair = Column(String) flair = Column(String)
ban_reason = Column(String) ban_reason = Column(String)
embed_url = Column(String) embed_url = Column(String)
new = Column(Boolean)
author = relationship("User", primaryjoin="Submission.author_id==User.id") author = relationship("User", primaryjoin="Submission.author_id==User.id")
oauth_app = relationship("OauthApp", viewonly=True) oauth_app = relationship("OauthApp", viewonly=True)

View File

@ -159,7 +159,7 @@ def post_id(pid, anything=None, v=None, sub=None):
post = get_post(pid, v=v) post = get_post(pid, v=v)
if 'megathread' in post.title.lower(): defaultsortingcomments = 'new' if post.new: 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)
@ -1093,6 +1093,7 @@ def submit_post(v, sub=None):
club=club, club=club,
author_id=v.id, author_id=v.id,
over_18=bool(request.values.get("over_18","")), 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, app_id=v.client.application.id if v.client else None,
is_bot = request.headers.get("Authorization"), is_bot = request.headers.get("Authorization"),
url=url, url=url,
@ -1389,7 +1390,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 'megathread' in post.title.lower(): sort = 'new' if post.new: 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)

View File

@ -165,6 +165,11 @@
<label class="custom-control-label" for="followers">Alert Followers</label> <label class="custom-control-label" for="followers">Alert Followers</label>
</div> </div>
<div class="custom-control custom-checkbox">
<input autocomplete="off" type="checkbox" class="custom-control-input" id="new" name="new">
<label class="custom-control-label" for="new">Make the default comment sorting "new"</label>
</div>
<div class="custom-control custom-checkbox"> <div class="custom-control custom-checkbox">
<input autocomplete="off" type="checkbox" class="custom-control-input" id="nsfw" name="over_18"> <input autocomplete="off" type="checkbox" class="custom-control-input" id="nsfw" name="over_18">
<label class="custom-control-label" for="nsfw">+18</label> <label class="custom-control-label" for="nsfw">+18</label>