From 0ad845e0f7c6025e6dbaad5740234506022d479f Mon Sep 17 00:00:00 2001 From: Kitaiti Makoto Date: Tue, 3 May 2022 00:22:22 +0900 Subject: [PATCH] Remove unused User::fetch_outbox() --- plume-models/src/users.rs | 55 +++------------------------------------ 1 file changed, 3 insertions(+), 52 deletions(-) diff --git a/plume-models/src/users.rs b/plume-models/src/users.rs index f0daac60..0677a09a 100644 --- a/plume-models/src/users.rs +++ b/plume-models/src/users.rs @@ -4,14 +4,13 @@ use crate::{ safe_string::SafeString, schema::users, timeline::Timeline, Connection, Error, Result, UserEvent::*, CONFIG, ITEMS_PER_PAGE, USER_CHAN, }; -use activitypub::Activity; use activitystreams::{ activity::Delete, actor::{ApActor, AsApActor, Endpoints, Person}, base::{AnyBase, Base}, collection::{OrderedCollection, OrderedCollectionPage}, iri_string::types::IriString, - markers::Activity as Activity07, + markers::Activity, object::{kind::ImageType, AsObject as _, Image, Tombstone}, prelude::*, }; @@ -513,21 +512,8 @@ impl User { coll.set_part_of(self.outbox_url.parse::()?); Ok(coll) } - fn fetch_outbox_page(&self, url: &str) -> Result<(Vec, Option)> { - let mut res = get(url, Self::get_sender07(), CONFIG.proxy().cloned())?; - let text = &res.text()?; - let json: serde_json::Value = serde_json::from_str(text)?; - let items = json["items"] - .as_array() - .unwrap_or(&vec![]) - .iter() - .filter_map(|j| serde_json::from_value(j.clone()).ok()) - .collect::>(); - let next = json.get("next").map(|x| x.as_str().unwrap().to_owned()); - Ok((items, next)) - } - pub fn fetch_outbox_page07( + pub fn fetch_outbox_page07( &self, url: &str, ) -> Result<(Vec, Option)> { @@ -544,43 +530,8 @@ impl User { let next = json.get("next").map(|x| x.as_str().unwrap().to_owned()); Ok((items, next)) } - pub fn fetch_outbox(&self) -> Result> { - let mut res = get( - &self.outbox_url[..], - Self::get_sender07(), - CONFIG.proxy().cloned(), - )?; - let text = &res.text()?; - let json: serde_json::Value = serde_json::from_str(text)?; - if let Some(first) = json.get("first") { - let mut items: Vec = Vec::new(); - let mut next = first.as_str().unwrap().to_owned(); - while let Ok((mut page, nxt)) = self.fetch_outbox_page(&next) { - if page.is_empty() { - break; - } - items.append(&mut page); - if let Some(n) = nxt { - if n == next { - break; - } - next = n; - } else { - break; - } - } - Ok(items) - } else { - Ok(json["items"] - .as_array() - .unwrap_or(&vec![]) - .iter() - .filter_map(|j| serde_json::from_value(j.clone()).ok()) - .collect::>()) - } - } - pub fn fetch_outbox07(&self) -> Result> { + pub fn fetch_outbox07(&self) -> Result> { let mut res = get( &self.outbox_url[..], Self::get_sender07(),