forked from MarseyWorld/MarseyWorld
add "warm" sorting - exact same as hot but pinned posts are shown in their normal positions instead of the top
parent
e121523a42
commit
ab2d9b492d
|
@ -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":
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Reference in New Issue