Fix #230: present pinned posts first in all sorts.

This commit is contained in:
TLSM 2022-09-04 16:34:10 -04:00 committed by Ben Rog-Wilhelm
parent fd3fd7e04e
commit b31e1874dd

View file

@ -323,7 +323,7 @@ def frontlist(v=None, sort="hot", page=1, t="all", ids_only=True, ccmode="false"
posts = posts.filter_by(is_banned=False, private=False, deleted_utc = 0)
if (sort == "hot" or (v and v.id == Q_ID)) and ccmode == "false" and not gt and not lt:
if ccmode == "false" and not gt and not lt:
posts = posts.filter_by(stickied=None)
if v and v.admin_level < 2:
@ -369,7 +369,7 @@ def frontlist(v=None, sort="hot", page=1, t="all", ids_only=True, ccmode="false"
posts = posts[:size]
if (sort == "hot" or (v and v.id == Q_ID)) and page == 1 and ccmode == "false" and not gt and not lt:
if page == 1 and ccmode == "false" and not gt and not lt:
pins = g.db.query(Submission).filter(Submission.stickied != None, Submission.is_banned == False)
if sub: pins = pins.filter_by(sub=sub.name)
elif v: