Extract Blog::outbox_collection_page()

This commit is contained in:
Kitaiti Makoto 2022-02-23 02:12:27 +09:00
parent 0ed91b89ff
commit e27fc47287

View File

@ -254,6 +254,14 @@ impl Blog {
conn: &Connection, conn: &Connection,
(min, max): (i32, i32), (min, max): (i32, i32),
) -> Result<ActivityStream<OrderedCollectionPage>> { ) -> Result<ActivityStream<OrderedCollectionPage>> {
self.outbox_collection_page(conn, (min, max))
.map(|coll| ActivityStream::new(coll))
}
pub fn outbox_collection_page(
&self,
conn: &Connection,
(min, max): (i32, i32),
) -> Result<OrderedCollectionPage> {
let mut coll = OrderedCollectionPage::default(); let mut coll = OrderedCollectionPage::default();
let acts = self.get_activity_page(conn, (min, max)); let acts = self.get_activity_page(conn, (min, max));
//This still doesn't do anything because the outbox //This still doesn't do anything because the outbox
@ -269,7 +277,7 @@ impl Blog {
min / ITEMS_PER_PAGE - 1 min / ITEMS_PER_PAGE - 1
)))?; )))?;
coll.collection_props.items = serde_json::to_value(acts)?; coll.collection_props.items = serde_json::to_value(acts)?;
Ok(ActivityStream::new(coll)) Ok(coll)
} }
fn get_activities(&self, _conn: &Connection) -> Vec<serde_json::Value> { fn get_activities(&self, _conn: &Connection) -> Vec<serde_json::Value> {
vec![] vec![]