respect filter.limit in the /messages endpoint

As far as I can tell, 'filter.limit' and the 'limit' query parameter are
completely redundant.
This commit is contained in:
Benjamin Lee 2024-05-02 18:30:39 -07:00
parent 296b777c04
commit ecb0a55511
No known key found for this signature in database
GPG key ID: FB9624E2885D55A4

View file

@ -159,7 +159,9 @@ pub(crate) async fn get_message_events_route(
.lazy_load_confirm_delivery(sender_user, sender_device, &body.room_id, from) .lazy_load_confirm_delivery(sender_user, sender_device, &body.room_id, from)
.await?; .await?;
let limit = u64::from(body.limit).min(100) as usize; let limit = u64::from(body.limit)
.min(body.filter.limit.map_or(u64::MAX, u64::from))
.min(100) as usize;
let next_token; let next_token;