mirror of
https://github.com/liamcottle/reticulum-meshchat.git
synced 2026-04-28 00:20:48 +00:00
limit ui to showing 500 latest announces
This commit is contained in:
parent
e53fca5f96
commit
bc53516c64
2 changed files with 8 additions and 2 deletions
|
|
@ -768,6 +768,7 @@ class ReticulumMeshChat:
|
|||
|
||||
# get query params
|
||||
aspect = request.query.get("aspect", None)
|
||||
limit = request.query.get("limit", None)
|
||||
|
||||
# build announces database query
|
||||
query = database.Announce.select()
|
||||
|
|
@ -776,8 +777,12 @@ class ReticulumMeshChat:
|
|||
if aspect is not None:
|
||||
query = query.where(database.Announce.aspect == aspect)
|
||||
|
||||
# get announces from database
|
||||
query_results = query.order_by(database.Announce.id.asc())
|
||||
# limit results
|
||||
if limit is not None:
|
||||
query = query.limit(limit)
|
||||
|
||||
# order announces latest to oldest
|
||||
query_results = query.order_by(database.Announce.updated_at.desc())
|
||||
|
||||
# process announces
|
||||
announces = []
|
||||
|
|
|
|||
|
|
@ -143,6 +143,7 @@ export default {
|
|||
const response = await window.axios.get(`/api/v1/announces`, {
|
||||
params: {
|
||||
aspect: "lxmf.delivery",
|
||||
limit: 500, // limit ui to showing 500 latest announces
|
||||
},
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue