From 3b429909f1dab00ee29d7a9d6fb7cf5ebdf4e222 Mon Sep 17 00:00:00 2001 From: Kitaiti Makoto Date: Mon, 10 Jan 2022 22:18:59 +0900 Subject: [PATCH] Extract User::outbox_collection_page() from outbox_collection() for testablity --- plume-models/src/users.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/plume-models/src/users.rs b/plume-models/src/users.rs index 9b2bffff..53b35fa0 100644 --- a/plume-models/src/users.rs +++ b/plume-models/src/users.rs @@ -450,6 +450,15 @@ impl User { conn: &Connection, (min, max): (i32, i32), ) -> Result> { + Ok(ActivityStream::new( + self.outbox_collection_page(conn, (min, max))?, + )) + } + pub fn outbox_collection_page( + &self, + conn: &Connection, + (min, max): (i32, i32), + ) -> Result { let acts = self.get_activities_page(conn, (min, max))?; let n_acts = self.get_activities_count(conn); let mut coll = OrderedCollectionPage::default(); @@ -470,7 +479,7 @@ impl User { coll.collection_props.items = serde_json::to_value(acts)?; coll.collection_page_props .set_part_of_link(Id::new(&self.outbox_url))?; - Ok(ActivityStream::new(coll)) + Ok(coll) } fn fetch_outbox_page(&self, url: &str) -> Result<(Vec, Option)> { let mut res = get(url, Self::get_sender(), CONFIG.proxy().cloned())?;