add "warm" sorting - exact same as hot but pinned posts are shown in their normal positions instead of the top

remotes/1693045480750635534/spooky-22
Aevann1 2022-07-03 04:40:57 +02:00
parent e121523a42
commit ab2d9b492d
3 changed files with 3 additions and 3 deletions

View File

@ -295,7 +295,7 @@ def frontlist(v=None, sort="hot", page=1, t="all", ids_only=True, ccmode="false"
if request.host == 'rdrama.net': num = 5
else: num = 0.5
if sort == "hot":
if sort in ("hot","warm"):
ti = int(time.time()) + 3600
posts = posts.order_by(-1000000*(Submission.realupvotes + 1 + Submission.comment_count/num)/(func.power(((ti - Submission.created_utc)/1000), 1.23)), Submission.created_utc.desc())
elif sort == "bump":

View File

@ -251,7 +251,7 @@ def settings_profile_post(v):
defaultsorting = request.values.get("defaultsorting")
if defaultsorting:
if defaultsorting in {"hot", "bump", "new", "old", "comments", "controversial", "top", "bottom"}:
if defaultsorting in {"hot", "warm", "bump", "new", "old", "comments", "controversial", "top", "bottom"}:
v.defaultsorting = defaultsorting
updated = True
else: abort(400)

View File

@ -90,7 +90,7 @@
<p>Change the default sorting for posts.</p>
<div class="input-group mb2">
<select autocomplete="off" id='defaultsorting' class="form-control" form="profile-settings" name="defaultsorting" onchange="post_toast(this,'/settings/profile?defaultsorting='+document.getElementById('defaultsorting').value)">
{% for entry in ["hot", "bump", "new", "old", "top", "bottom", "controversial", "comments"] %}
{% for entry in ["hot", "warm", "bump", "new", "old", "top", "bottom", "controversial", "comments"] %}
<option value="{{entry}}"{{' selected' if v.defaultsorting==entry}}>{{entry}}</option>
{% endfor %}
</select>