Remove unnecessary wraps
This commit is contained in:
parent
be939cf169
commit
3fd89e6b48
@ -216,16 +216,16 @@ impl Blog {
|
|||||||
|
|
||||||
pub fn outbox(&self, conn: &Connection) -> Result<ActivityStream<OrderedCollection>> {
|
pub fn outbox(&self, conn: &Connection) -> Result<ActivityStream<OrderedCollection>> {
|
||||||
let mut coll = OrderedCollection::default();
|
let mut coll = OrderedCollection::default();
|
||||||
coll.collection_props.items = serde_json::to_value(self.get_activities(conn)?)?;
|
coll.collection_props.items = serde_json::to_value(self.get_activities(conn))?;
|
||||||
coll.collection_props
|
coll.collection_props
|
||||||
.set_total_items_u64(self.get_activities(conn)?.len() as u64)?;
|
.set_total_items_u64(self.get_activities(conn).len() as u64)?;
|
||||||
coll.collection_props
|
coll.collection_props
|
||||||
.set_first_link(Id::new(ap_url(&format!("{}?page=1", &self.outbox_url))))?;
|
.set_first_link(Id::new(ap_url(&format!("{}?page=1", &self.outbox_url))))?;
|
||||||
coll.collection_props
|
coll.collection_props
|
||||||
.set_last_link(Id::new(ap_url(&format!(
|
.set_last_link(Id::new(ap_url(&format!(
|
||||||
"{}?page={}",
|
"{}?page={}",
|
||||||
&self.outbox_url,
|
&self.outbox_url,
|
||||||
(self.get_activities(conn)?.len() as u64 + ITEMS_PER_PAGE as u64 - 1) as u64
|
(self.get_activities(conn).len() as u64 + ITEMS_PER_PAGE as u64 - 1) as u64
|
||||||
/ ITEMS_PER_PAGE as u64
|
/ ITEMS_PER_PAGE as u64
|
||||||
))))?;
|
))))?;
|
||||||
Ok(ActivityStream::new(coll))
|
Ok(ActivityStream::new(coll))
|
||||||
@ -236,7 +236,7 @@ impl Blog {
|
|||||||
(min, max): (i32, i32),
|
(min, max): (i32, i32),
|
||||||
) -> Result<ActivityStream<OrderedCollectionPage>> {
|
) -> Result<ActivityStream<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
|
||||||
//doesn't do anything yet
|
//doesn't do anything yet
|
||||||
coll.collection_page_props.set_next_link(Id::new(&format!(
|
coll.collection_page_props.set_next_link(Id::new(&format!(
|
||||||
@ -252,15 +252,15 @@ impl Blog {
|
|||||||
coll.collection_props.items = serde_json::to_value(acts)?;
|
coll.collection_props.items = serde_json::to_value(acts)?;
|
||||||
Ok(ActivityStream::new(coll))
|
Ok(ActivityStream::new(coll))
|
||||||
}
|
}
|
||||||
fn get_activities(&self, _conn: &Connection) -> Result<Vec<serde_json::Value>> {
|
fn get_activities(&self, _conn: &Connection) -> Vec<serde_json::Value> {
|
||||||
Ok(vec![])
|
vec![]
|
||||||
}
|
}
|
||||||
fn get_activity_page(
|
fn get_activity_page(
|
||||||
&self,
|
&self,
|
||||||
_conn: &Connection,
|
_conn: &Connection,
|
||||||
(_min, _max): (i32, i32),
|
(_min, _max): (i32, i32),
|
||||||
) -> Result<Vec<serde_json::Value>> {
|
) -> Vec<serde_json::Value> {
|
||||||
Ok(vec![])
|
vec![]
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_keypair(&self) -> Result<PKey<Private>> {
|
pub fn get_keypair(&self) -> Result<PKey<Private>> {
|
||||||
|
@ -81,6 +81,7 @@ lazy_static! {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(clippy::unnecessary_wraps)]
|
||||||
fn url_add_prefix(url: &str) -> Option<Cow<'_, str>> {
|
fn url_add_prefix(url: &str) -> Option<Cow<'_, str>> {
|
||||||
if url.starts_with('#') && !url.starts_with("#postcontent-") {
|
if url.starts_with('#') && !url.starts_with("#postcontent-") {
|
||||||
//if start with an #
|
//if start with an #
|
||||||
|
Loading…
Reference in New Issue
Block a user