fsd
This commit is contained in:
parent
10f2639ce9
commit
bb084df85b
13 changed files with 84 additions and 145 deletions
|
@ -142,21 +142,11 @@ class Comment(Base):
|
|||
years = now.tm_year - ctd.tm_year
|
||||
return f"{years}yr ago"
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def score(self):
|
||||
return self.upvotes - self.downvotes
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def fullname(self):
|
||||
return f"t3_{self.id}"
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def score_disputed(self):
|
||||
return (self.upvotes+1) * (self.downvotes+1)
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def parent(self):
|
||||
|
|
|
@ -165,21 +165,11 @@ class Submission(Base):
|
|||
return str(time.strftime("%d/%B/%Y %H:%M:%S UTC", time.gmtime(self.edited_utc)))
|
||||
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def score(self):
|
||||
return self.upvotes - self.downvotes
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def hotscore(self):
|
||||
return 10000000*(self.upvotes - self.downvotes + 1)/(((self.age+3600)/1000)**(1.35))
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def score_disputed(self):
|
||||
return (self.upvotes+1) * (self.downvotes+1)
|
||||
|
||||
|
||||
@property
|
||||
@lazy
|
||||
|
|
|
@ -241,10 +241,10 @@ class User(Base):
|
|||
if self.shadowbanned and not (v and (v.admin_level >= 3 or v.id == self.id)):
|
||||
return []
|
||||
|
||||
submissions = g.db.query(Submission).options(lazyload('*')).filter_by(author_id=self.id, is_pinned=False)
|
||||
posts = g.db.query(Submission.id).options(lazyload('*')).filter_by(author_id=self.id, is_pinned=False)
|
||||
|
||||
if not (v and (v.admin_level >= 3 or v.id == self.id)):
|
||||
submissions = submissions.filter_by(deleted_utc=0, is_banned=False, private=False)
|
||||
posts = posts.filter_by(deleted_utc=0, is_banned=False, private=False)
|
||||
|
||||
now = int(time.time())
|
||||
if t == 'hour':
|
||||
|
@ -259,25 +259,24 @@ class User(Base):
|
|||
cutoff = now - 31536000
|
||||
else:
|
||||
cutoff = 0
|
||||
submissions = submissions.filter(Submission.created_utc >= cutoff)
|
||||
posts = posts.filter(Submission.created_utc >= cutoff)
|
||||
|
||||
if sort == "new":
|
||||
submissions = submissions.order_by(Submission.created_utc.desc()).all()
|
||||
posts = posts.order_by(Submission.created_utc.desc())
|
||||
elif sort == "old":
|
||||
submissions = submissions.order_by(Submission.created_utc.asc()).all()
|
||||
posts = posts.order_by(Submission.created_utc.asc())
|
||||
elif sort == "controversial":
|
||||
submissions = sorted(submissions.all(), key=lambda x: x.score_disputed, reverse=True)
|
||||
posts = posts.order_by(Submission.upvotes * Submission.downvotes)
|
||||
elif sort == "top":
|
||||
submissions = sorted(submissions.all(), key=lambda x: x.score, reverse=True)
|
||||
posts = posts.order_by(Submission.downvotes - Submission.upvotes)
|
||||
elif sort == "bottom":
|
||||
submissions = sorted(submissions.all(), key=lambda x: x.score)
|
||||
posts = posts.order_by(Submission.upvotes - Submission.downvotes)
|
||||
elif sort == "comments":
|
||||
submissions = submissions.order_by(Submission.comment_count.desc()).all()
|
||||
posts = posts.order_by(Submission.comment_count.desc())
|
||||
|
||||
firstrange = 25 * (page - 1)
|
||||
secondrange = firstrange + 26
|
||||
listing = [x.id for x in submissions[firstrange:secondrange]]
|
||||
return listing
|
||||
posts = posts.offset(25 * (page - 1)).limit(26).all()
|
||||
|
||||
return [x[0] for x in posts]
|
||||
|
||||
@property
|
||||
@lazy
|
||||
|
|
|
@ -109,10 +109,10 @@ def notifications(v):
|
|||
|
||||
|
||||
|
||||
# @cache.memoize(timeout=86400)
|
||||
@cache.memoize(timeout=86400)
|
||||
def frontlist(v=None, sort="hot", page=1, t="all", ids_only=True, filter_words='', **kwargs):
|
||||
|
||||
posts = g.db.query(Submission).options(lazyload('*'))
|
||||
posts = g.db.query(Submission.id).options(lazyload('*'))
|
||||
|
||||
if 'rdrama' in request.host and t != 'day' and sort in ["hot","controversial"]:
|
||||
cutoff = int(time.time()) - 86400
|
||||
|
@ -172,35 +172,32 @@ def frontlist(v=None, sort="hot", page=1, t="all", ids_only=True, filter_words='
|
|||
|
||||
if sort == "hot":
|
||||
posts = sorted(posts.all(), key=lambda x: x.hotscore, reverse=True)
|
||||
firstrange = 25 * (page - 1)
|
||||
secondrange = firstrange+100
|
||||
posts = posts[firstrange:secondrange]
|
||||
elif sort == "new":
|
||||
posts = posts.order_by(Submission.created_utc.desc()).all()
|
||||
posts = posts.order_by(Submission.created_utc.desc())
|
||||
elif sort == "old":
|
||||
posts = posts.order_by(Submission.created_utc.asc()).all()
|
||||
posts = posts.order_by(Submission.created_utc.asc())
|
||||
elif sort == "controversial":
|
||||
posts = sorted(posts.all(), key=lambda x: x.score_disputed, reverse=True)
|
||||
posts = posts.order_by(Submission.upvotes * Submission.downvotes)
|
||||
elif sort == "top":
|
||||
posts = posts.order_by(Submission.downvotes - Submission.upvotes).all()
|
||||
posts = posts.order_by(Submission.downvotes - Submission.upvotes)
|
||||
elif sort == "bottom":
|
||||
posts = sorted(posts.all(), key=lambda x: x.score)
|
||||
posts = posts.order_by(Submission.upvotes - Submission.downvotes)
|
||||
elif sort == "comments":
|
||||
posts = posts.order_by(Submission.comment_count.desc()).all()
|
||||
elif sort == "random":
|
||||
posts = posts.all()
|
||||
posts = random.sample(posts, k=len(posts))
|
||||
else:
|
||||
abort(400)
|
||||
posts = posts.order_by(Submission.comment_count.desc())
|
||||
|
||||
if sort != "hot": posts = posts.offset(25 * (page - 1)).limit(26).all()
|
||||
|
||||
firstrange = 25 * (page - 1)
|
||||
secondrange = firstrange+100
|
||||
posts = posts[firstrange:secondrange]
|
||||
|
||||
next_exists = (len(posts) > 25)
|
||||
|
||||
posts = posts[:25]
|
||||
|
||||
if page == 1: posts = g.db.query(Submission).options(lazyload('*')).filter(Submission.stickied != None).all() + posts
|
||||
if page == 1: posts = g.db.query(Submission.id).options(lazyload('*')).filter(Submission.stickied != None).all() + posts
|
||||
|
||||
if ids_only: posts = [x.id for x in posts]
|
||||
if ids_only: posts = [x[0] for x in posts]
|
||||
|
||||
return posts, next_exists
|
||||
|
||||
|
@ -249,7 +246,7 @@ def front_all(v):
|
|||
@cache.memoize(timeout=86400)
|
||||
def changeloglist(v=None, sort="new", page=1 ,t="all", **kwargs):
|
||||
|
||||
posts = g.db.query(Submission).options(lazyload('*')).filter_by(is_banned=False, private=False,).filter(Submission.deleted_utc == 0)
|
||||
posts = g.db.query(Submission.id).options(lazyload('*')).filter_by(is_banned=False, private=False,).filter(Submission.deleted_utc == 0)
|
||||
|
||||
if v and v.admin_level == 0:
|
||||
blocking = [x[0] for x in g.db.query(
|
||||
|
@ -290,32 +287,22 @@ def changeloglist(v=None, sort="new", page=1 ,t="all", **kwargs):
|
|||
if lt:
|
||||
posts = posts.filter(Submission.created_utc < lt)
|
||||
|
||||
if sort == "hot":
|
||||
posts = sorted(posts.all(), key=lambda x: x.hotscore, reverse=True)
|
||||
elif sort == "new":
|
||||
posts = posts.order_by(Submission.created_utc.desc()).all()
|
||||
if sort == "new":
|
||||
posts = posts.order_by(Submission.created_utc.desc())
|
||||
elif sort == "old":
|
||||
posts = posts.order_by(Submission.created_utc.asc()).all()
|
||||
posts = posts.order_by(Submission.created_utc.asc())
|
||||
elif sort == "controversial":
|
||||
posts = sorted(posts.all(), key=lambda x: x.score_disputed, reverse=True)
|
||||
posts = posts.order_by(Submission.upvotes * Submission.downvotes)
|
||||
elif sort == "top":
|
||||
posts = sorted(posts.all(), key=lambda x: x.score, reverse=True)
|
||||
posts = posts.order_by(Submission.downvotes - Submission.upvotes)
|
||||
elif sort == "bottom":
|
||||
posts = sorted(posts.all(), key=lambda x: x.score)
|
||||
posts = posts.order_by(Submission.upvotes - Submission.downvotes)
|
||||
elif sort == "comments":
|
||||
posts = posts.order_by(Submission.comment_count.desc()).all()
|
||||
elif sort == "random":
|
||||
posts = posts.all()
|
||||
posts = random.sample(posts, k=len(posts))
|
||||
else:
|
||||
abort(400)
|
||||
posts = posts.order_by(Submission.comment_count.desc())
|
||||
|
||||
firstrange = 25 * (page - 1)
|
||||
secondrange = firstrange+26
|
||||
posts = posts[firstrange:secondrange]
|
||||
posts = posts.offset(25 * (page - 1)).limit(26).all()
|
||||
|
||||
posts = [x.id for x in posts]
|
||||
return posts
|
||||
return [x[0] for x in posts]
|
||||
|
||||
@app.get("/changelog")
|
||||
@auth_desired
|
||||
|
@ -366,7 +353,7 @@ def comment_idlist(page=1, v=None, nsfw=False, sort="new", t="all", **kwargs):
|
|||
|
||||
posts = posts.subquery()
|
||||
|
||||
comments = g.db.query(Comment).options(lazyload('*')).filter(Comment.parent_submission.notin_(cc_idlist))
|
||||
comments = g.db.query(Comment.id).options(lazyload('*')).filter(Comment.parent_submission.notin_(cc_idlist))
|
||||
|
||||
if v and v.admin_level <= 3:
|
||||
blocking = [x[0] for x in g.db.query(
|
||||
|
@ -402,21 +389,18 @@ def comment_idlist(page=1, v=None, nsfw=False, sort="new", t="all", **kwargs):
|
|||
comments = comments.filter(Comment.created_utc >= cutoff)
|
||||
|
||||
if sort == "new":
|
||||
comments = comments.order_by(Comment.created_utc.desc()).all()
|
||||
comments = comments.order_by(Comment.created_utc.desc())
|
||||
elif sort == "old":
|
||||
comments = comments.order_by(Comment.created_utc.asc()).all()
|
||||
comments = comments.order_by(Comment.created_utc.asc())
|
||||
elif sort == "controversial":
|
||||
comments = sorted(comments.all(), key=lambda x: x.score_disputed, reverse=True)
|
||||
comments = comments.order_by(Comment.upvotes * Comment.downvotes)
|
||||
elif sort == "top":
|
||||
comments = sorted(comments.all(), key=lambda x: x.score, reverse=True)
|
||||
comments = comments.order_by(Comment.downvotes - Comment.upvotes)
|
||||
elif sort == "bottom":
|
||||
comments = sorted(comments.all(), key=lambda x: x.score)
|
||||
comments = comments.order_by(Comment.upvotes - Comment.downvotes)
|
||||
|
||||
firstrange = 25 * (page - 1)
|
||||
secondrange = firstrange+26
|
||||
comments = comments[firstrange:secondrange]
|
||||
|
||||
return [x.id for x in comments]
|
||||
comments = comments.offset(25 * (page - 1)).limit(26).all()
|
||||
return [x[0] for x in comments]
|
||||
|
||||
@app.get("/comments")
|
||||
@auth_desired
|
||||
|
|
|
@ -147,24 +147,19 @@ def post_id(pid, anything=None, v=None):
|
|||
isouter=True
|
||||
)
|
||||
|
||||
if sort == "top":
|
||||
comments = sorted(comments.all(), key=lambda x: x[0].score, reverse=True)
|
||||
elif sort == "bottom":
|
||||
comments = sorted(comments.all(), key=lambda x: x[0].score)
|
||||
elif sort == "new":
|
||||
comments = comments.order_by(Comment.created_utc.desc()).all()
|
||||
if sort == "new":
|
||||
comments = comments.order_by(Comment.created_utc.desc())
|
||||
elif sort == "old":
|
||||
comments = comments.order_by(Comment.created_utc.asc()).all()
|
||||
comments = comments.order_by(Comment.created_utc.asc())
|
||||
elif sort == "controversial":
|
||||
comments = sorted(comments.all(), key=lambda x: x[0].score_disputed, reverse=True)
|
||||
elif sort == "random":
|
||||
c = comments.all()
|
||||
comments = random.sample(c, k=len(c))
|
||||
else:
|
||||
abort(422)
|
||||
comments = comments.order_by(Comment.upvotes * Comment.downvotes)
|
||||
elif sort == "top":
|
||||
comments = comments.order_by(Comment.downvotes - Comment.upvotes)
|
||||
elif sort == "bottom":
|
||||
comments = comments.order_by(Comment.upvotes - Comment.downvotes)
|
||||
|
||||
output = []
|
||||
for c in comments:
|
||||
for c in comments.all():
|
||||
comment = c[0]
|
||||
comment.voted = c[1] or 0
|
||||
comment.is_blocking = c[2] or 0
|
||||
|
@ -177,23 +172,18 @@ def post_id(pid, anything=None, v=None):
|
|||
shadowbanned = [x[0] for x in g.db.query(User.id).options(lazyload('*')).filter(User.shadowbanned == True).all()]
|
||||
comments = g.db.query(Comment).filter(Comment.parent_submission == post.id, Comment.author_id.notin_(shadowbanned))
|
||||
|
||||
if sort == "top":
|
||||
comments = sorted(comments.all(), key=lambda x: x.score, reverse=True)
|
||||
elif sort == "bottom":
|
||||
comments = sorted(comments.all(), key=lambda x: x.score)
|
||||
elif sort == "new":
|
||||
comments = comments.order_by(Comment.created_utc.desc()).all()
|
||||
if sort == "new":
|
||||
comments = comments.order_by(Comment.created_utc.desc())
|
||||
elif sort == "old":
|
||||
comments = comments.order_by(Comment.created_utc.asc()).all()
|
||||
comments = comments.order_by(Comment.created_utc.asc())
|
||||
elif sort == "controversial":
|
||||
comments = sorted(comments.all(), key=lambda x: x.score_disputed, reverse=True)
|
||||
elif sort == "random":
|
||||
c = comments.all()
|
||||
comments = random.sample(c, k=len(c))
|
||||
else:
|
||||
abort(422)
|
||||
comments = comments.order_by(Comment.upvotes * Comment.downvotes)
|
||||
elif sort == "top":
|
||||
comments = comments.order_by(Comment.downvotes - Comment.upvotes)
|
||||
elif sort == "bottom":
|
||||
comments = comments.order_by(Comment.upvotes - Comment.downvotes)
|
||||
|
||||
post.preloaded_comments = comments
|
||||
post.preloaded_comments = comments.all()
|
||||
|
||||
if not v or v.highlightcomments:
|
||||
last_view_utc = session.get(str(post.id))
|
||||
|
|
|
@ -59,7 +59,7 @@ def searchposts(v):
|
|||
|
||||
|
||||
|
||||
posts = g.db.query(Submission).options(
|
||||
posts = g.db.query(Submission.id).options(
|
||||
lazyload('*')
|
||||
).join(
|
||||
Submission.submission_aux,
|
||||
|
@ -149,30 +149,23 @@ def searchposts(v):
|
|||
)
|
||||
|
||||
if sort == "new":
|
||||
posts = posts.order_by(Submission.created_utc.desc()).all()
|
||||
posts = posts.order_by(Submission.created_utc.desc())
|
||||
elif sort == "old":
|
||||
posts = posts.order_by(Submission.created_utc.asc()).all()
|
||||
posts = posts.order_by(Submission.created_utc.asc())
|
||||
elif sort == "controversial":
|
||||
posts = sorted(posts.all(), key=lambda x: x.score_disputed, reverse=True)
|
||||
posts = posts.order_by(Submission.upvotes * Submission.downvotes)
|
||||
elif sort == "top":
|
||||
posts = sorted(posts.all(), key=lambda x: x.score, reverse=True)
|
||||
posts = posts.order_by(Submission.downvotes - Submission.upvotes)
|
||||
elif sort == "bottom":
|
||||
posts = sorted(posts.all(), key=lambda x: x.score)
|
||||
posts = posts.order_by(Submission.upvotes - Submission.downvotes)
|
||||
elif sort == "comments":
|
||||
posts = posts.order_by(Submission.comment_count.desc()).all()
|
||||
elif sort == "random":
|
||||
posts = posts.all()
|
||||
posts = random.sample(posts, k=len(posts))
|
||||
else:
|
||||
abort(400)
|
||||
posts = posts.order_by(Submission.comment_count.desc())
|
||||
|
||||
posts = posts.offset(25 * (page - 1)).limit(26).all()
|
||||
|
||||
total = len(posts)
|
||||
|
||||
firstrange = 25 * (page - 1)
|
||||
secondrange = firstrange+26
|
||||
posts = posts[firstrange:secondrange]
|
||||
|
||||
ids = [x.id for x in posts]
|
||||
ids = [x[0] for x in posts]
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -169,7 +169,7 @@ def settings_profile_post(v):
|
|||
|
||||
defaultsortingcomments = request.values.get("defaultsortingcomments")
|
||||
if defaultsortingcomments:
|
||||
if defaultsortingcomments in ["new", "old", "controversial", "top", "bottom", "random"]:
|
||||
if defaultsortingcomments in ["new", "old", "controversial", "top", "bottom"]:
|
||||
v.defaultsortingcomments = defaultsortingcomments
|
||||
updated = True
|
||||
else:
|
||||
|
@ -177,7 +177,7 @@ def settings_profile_post(v):
|
|||
|
||||
defaultsorting = request.values.get("defaultsorting")
|
||||
if defaultsorting:
|
||||
if defaultsorting in ["hot", "new", "old", "comments", "controversial", "top", "bottom", "random"]:
|
||||
if defaultsorting in ["hot", "new", "old", "comments", "controversial", "top", "bottom"]:
|
||||
v.defaultsorting = defaultsorting
|
||||
updated = True
|
||||
else:
|
||||
|
|
|
@ -576,19 +576,18 @@ def u_username_comments(username, v=None):
|
|||
comments = comments.filter(Comment.created_utc >= cutoff)
|
||||
|
||||
if sort == "new":
|
||||
comments = comments.order_by(Comment.created_utc.desc()).all()
|
||||
comments = comments.order_by(Comment.created_utc.desc())
|
||||
elif sort == "old":
|
||||
comments = comments.order_by(Comment.created_utc.asc()).all()
|
||||
comments = comments.order_by(Comment.created_utc.asc())
|
||||
elif sort == "controversial":
|
||||
comments = sorted(comments.all(), key=lambda x: x.score_disputed, reverse=True)
|
||||
comments = comments.order_by(Comment.upvotes * Comment.downvotes)
|
||||
elif sort == "top":
|
||||
comments = sorted(comments.all(), key=lambda x: x.score, reverse=True)
|
||||
comments = comments.order_by(Comment.downvotes - Comment.upvotes)
|
||||
elif sort == "bottom":
|
||||
comments = sorted(comments.all(), key=lambda x: x.score)
|
||||
comments = comments.order_by(Comment.upvotes - Comment.downvotes)
|
||||
|
||||
firstrange = 25 * (page - 1)
|
||||
secondrange = firstrange + 26
|
||||
ids = [x.id for x in comments[firstrange:secondrange]]
|
||||
comments = comments.offset(25 * (page - 1)).limit(26).all()
|
||||
ids = [x.id for x in comments]
|
||||
|
||||
# we got 26 items just to see if a next page exists
|
||||
next_exists = (len(ids) > 25)
|
||||
|
|
|
@ -52,7 +52,6 @@
|
|||
{% if sort != "old" %}<a class="dropdown-item" href="?sort=old&t={{t}}"><i class="fas fa-book mr-2"></i>Old</a>{% endif %}
|
||||
{% if sort != "controversial" %}<a class="dropdown-item" href="?sort=controversial&t={{t}}"><i class="fas fa-bullhorn mr-2"></i>Controversial</a>{% endif %}
|
||||
{% if sort != "comments" %}<a class="dropdown-item" href="?sort=comments&t={{t}}"><i class="fas fa-comments mr-2"></i>Comments</a>{% endif %}
|
||||
{% if sort != "random" %}<a class="dropdown-item" href="?sort=random&t={{t}}"><i class="fas fa-random mr-2"></i>Random</a>{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -50,7 +50,6 @@
|
|||
{% if sort != "old" %}<a class="dropdown-item" href="?sort=old&t={{t}}"><i class="fas fa-book mr-2"></i>Old</a>{% endif %}
|
||||
{% if sort != "controversial" %}<a class="dropdown-item" href="?sort=controversial&t={{t}}"><i class="fas fa-bullhorn mr-2"></i>Controversial</a>{% endif %}
|
||||
{% if sort != "comments" %}<a class="dropdown-item" href="?sort=comments&t={{t}}"><i class="fas fa-comments mr-2"></i>Comments</a>{% endif %}
|
||||
{% if sort != "random" %}<a class="dropdown-item" href="?sort=random&t={{t}}"><i class="fas fa-random mr-2"></i>Random</a>{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -39,7 +39,6 @@
|
|||
{% if sort=="old" %}<i class="fas fa-book mr-1"></i>{% endif %}
|
||||
{% if sort=="controversial" %}<i class="fas fa-bullhorn mr-1"></i>{% endif %}
|
||||
{% if sort=="comments" %}<i class="fas fa-comments mr-1"></i>{% endif %}
|
||||
{% if sort=="random" %}<i class="fas fa-random mr-1"></i>{% endif %}
|
||||
{{sort | capitalize}}
|
||||
</button>
|
||||
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton" x-placement="bottom-start" style="position: absolute; will-change: transform; top: 0px; left: 0px; transform: translate3d(0px, 31px, 0px);">
|
||||
|
@ -49,7 +48,6 @@
|
|||
{% if not sort=="old" %}<a class="dropdown-item" href="?q={{query | urlencode}}&sort=old&t={{t}}"><i class="fas fa-book mr-2"></i>Old</a>{% endif %}
|
||||
{% if not sort=="controversial" %}<a class="dropdown-item" href="?q={{query | urlencode}}&sort=controversial&t={{t}}"><i class="fas fa-bullhorn mr-2"></i>Controversial</a>{% endif %}
|
||||
{% if not sort=="comments" %}<a class="dropdown-item" href="?q={{query | urlencode}}&sort=comments&t={{t}}"><i class="fas fa-comments mr-2"></i>Comments</a>{% endif %}
|
||||
{% if not sort=="random" %}<a class="dropdown-item" href="?q={{query | urlencode}}&sort=random&t={{t}}"><i class="fas fa-random mr-2"></i>Random</a>{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
<p>Change the default sorting for comments.</p>
|
||||
<div class="input-group mb2">
|
||||
<select id='defaultsortingcomments' class="form-control" form="profile-settings" name="defaultsortingcomments" onchange="post_toast('/settings/profile?defaultsortingcomments='+document.getElementById('defaultsortingcomments').value)">
|
||||
{% for entry in ["new", "old", "top", "bottom", "controversial", "random"] %}
|
||||
{% for entry in ["new", "old", "top", "bottom", "controversial"] %}
|
||||
<option value="{{entry}}"{{' selected' if v.defaultsortingcomments==entry else ''}}>{{entry}}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
|
@ -43,7 +43,7 @@
|
|||
<p>Change the default sorting for posts.</p>
|
||||
<div class="input-group mb2">
|
||||
<select id='defaultsorting' class="form-control" form="profile-settings" name="defaultsorting" onchange="post_toast('/settings/profile?defaultsorting='+document.getElementById('defaultsorting').value)">
|
||||
{% for entry in ["hot", "new", "old", "top", "bottom", "controversial", "comments", "random"] %}
|
||||
{% for entry in ["hot", "new", "old", "top", "bottom", "controversial", "comments"] %}
|
||||
<option value="{{entry}}"{{' selected' if v.defaultsorting==entry else ''}}>{{entry}}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
|
|
|
@ -595,7 +595,6 @@
|
|||
{% if sort=="new" %}<i class="fas fa-sparkles mr-1"></i>{% endif %}
|
||||
{% if sort=="old" %}<i class="fas fa-book mr-1"></i>{% endif %}
|
||||
{% if sort=="controversial" %}<i class="fas fa-bullhorn mr-1"></i>{% endif %}
|
||||
{% if sort=="random" %}<i class="fas fa-random mr-1"></i>{% endif %}
|
||||
{{sort | capitalize}}
|
||||
</button>
|
||||
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton" x-placement="bottom-start" style="position: absolute; will-change: transform; top: 0px; left: 0px; transform: translate3d(0px, 31px, 0px);">
|
||||
|
@ -604,7 +603,6 @@
|
|||
{% if sort != "new" %}<a class="dropdown-item" href="?sort=new"><i class="fas fa-sparkles mr-2"></i>New</a>{% endif %}
|
||||
{% if sort != "old" %}<a class="dropdown-item" href="?sort=old"><i class="fas fa-book mr-2"></i>Old</a>{% endif %}
|
||||
{% if sort != "controversial" %}<a class="dropdown-item" href="?sort=controversial"><i class="fas fa-bullhorn mr-2"></i>Controversial</a>{% endif %}
|
||||
{% if sort != "random" %}<a class="dropdown-item" href="?sort=random"><i class="fas fa-random mr-2"></i>Random</a>{% endif %}
|
||||
</div>
|
||||
{% if linked_comment and p.comment_count >= 2%}
|
||||
<pre></pre>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue