mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2026-05-26 20:49:55 +00:00
refactor: Fix errors in api/client/threads.rs
This commit is contained in:
@@ -7,7 +7,7 @@ use conduwuit::{
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
use futures::StreamExt;
|
use futures::StreamExt;
|
||||||
use ruma::{api::client::threads::get_threads, uint};
|
use ruma::{api::client::threads::get_threads, assign, uint};
|
||||||
|
|
||||||
use crate::Ruma;
|
use crate::Ruma;
|
||||||
|
|
||||||
@@ -59,18 +59,18 @@ pub(crate) async fn get_threads_route(
|
|||||||
.collect()
|
.collect()
|
||||||
.await;
|
.await;
|
||||||
|
|
||||||
Ok(get_threads::v1::Response {
|
let next_batch = threads
|
||||||
next_batch: threads
|
|
||||||
.last()
|
.last()
|
||||||
.filter(|_| threads.len() >= limit)
|
.filter(|_| threads.len() >= limit)
|
||||||
.map(at!(0))
|
.map(at!(0))
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.map(ToString::to_string),
|
.map(ToString::to_string);
|
||||||
|
|
||||||
chunk: threads
|
let chunk = threads
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(at!(1))
|
.map(at!(1))
|
||||||
.map(Event::into_format)
|
.map(Event::into_format)
|
||||||
.collect(),
|
.collect();
|
||||||
})
|
|
||||||
|
Ok(assign!(get_threads::v1::Response::new(chunk), { next_batch }))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user