fix: context should be ASC and in larger chunks

This commit is contained in:
əlemi 2024-11-21 00:30:54 +01:00
parent 8a0229a04d
commit bc9f55d58c
Signed by: alemi
GPG key ID: A4895B84D311642C

View file

@ -27,13 +27,14 @@ pub async fn page(
AuthIdentity(auth): AuthIdentity, AuthIdentity(auth): AuthIdentity,
) -> crate::ApiResult<JsonLD<serde_json::Value>> { ) -> crate::ApiResult<JsonLD<serde_json::Value>> {
let context = ctx.oid(&id); let context = ctx.oid(&id);
let limit = page.batch.unwrap_or(20).min(50); let limit = page.batch.unwrap_or(50).min(50);
let offset = page.offset.unwrap_or(0); let offset = page.offset.unwrap_or(0);
let items = upub::Query::objects(auth.my_id()) let items = upub::Query::objects(auth.my_id())
.filter(auth.filter()) .filter(auth.filter())
.filter(model::object::Column::Context.eq(context)) .filter(model::object::Column::Context.eq(context))
.order_by(model::object::Column::Published, Order::Desc) // note that this should be ASC so we get replies somewhat ordered
.order_by(model::object::Column::Published, Order::Asc)
.limit(limit) .limit(limit)
.offset(offset) .offset(offset)
.into_model::<RichActivity>() .into_model::<RichActivity>()