mirror of
https://git.sr.ht/~tsileo/microblog.pub
synced 2024-12-22 21:24:28 +00:00
Fix the index
This commit is contained in:
parent
a5e0983ca8
commit
f7a5f56955
1 changed files with 14 additions and 8 deletions
22
app.py
22
app.py
|
@ -805,17 +805,23 @@ def index():
|
||||||
"meta.undo": False,
|
"meta.undo": False,
|
||||||
"$or": [{"meta.pinned": False}, {"meta.pinned": {"$exists": False}}],
|
"$or": [{"meta.pinned": False}, {"meta.pinned": {"$exists": False}}],
|
||||||
}
|
}
|
||||||
q_pinned = {
|
|
||||||
"box": Box.OUTBOX.value,
|
pinned = []
|
||||||
"type": ActivityType.CREATE.value,
|
# Only fetch the pinned notes if we're on the first page
|
||||||
"meta.deleted": False,
|
if not request.args.get("older_than") and not request.args.get("newer_than"):
|
||||||
"meta.undo": False,
|
q_pinned = {
|
||||||
"meta.pinned": True,
|
"box": Box.OUTBOX.value,
|
||||||
}
|
"type": ActivityType.CREATE.value,
|
||||||
pinned = list(DB.activities.find(q_pinned))
|
"meta.deleted": False,
|
||||||
|
"meta.undo": False,
|
||||||
|
"meta.pinned": True,
|
||||||
|
}
|
||||||
|
pinned = list(DB.activities.find(q_pinned))
|
||||||
|
|
||||||
outbox_data, older_than, newer_than = paginated_query(
|
outbox_data, older_than, newer_than = paginated_query(
|
||||||
DB.activities, q, limit=25 - len(pinned)
|
DB.activities, q, limit=25 - len(pinned)
|
||||||
)
|
)
|
||||||
|
|
||||||
return render_template(
|
return render_template(
|
||||||
"index.html",
|
"index.html",
|
||||||
outbox_data=outbox_data,
|
outbox_data=outbox_data,
|
||||||
|
|
Loading…
Reference in a new issue