This commit is contained in:
phiresky 2023-08-22 14:59:49 +00:00
parent 574e23cc61
commit eb761bbdcf
4 changed files with 9 additions and 8 deletions

View file

@ -3,15 +3,14 @@ use crate::{
schema::sent_activity, schema::sent_activity,
}; };
use diesel::{ use diesel::{
backend::Backend,
deserialize::FromSql, deserialize::FromSql,
pg::{Pg, PgValue}, pg::{Pg, PgValue},
serialize::{Output, ToSql}, serialize::{Output, ToSql},
sql_types::{Array, Jsonb, Nullable}, sql_types::{Jsonb, Nullable},
Queryable, Queryable,
}; };
use serde_json::Value; use serde_json::Value;
use std::{collections::HashSet, fmt::Debug, hash::Hash, io::Write}; use std::{collections::HashSet, fmt::Debug, io::Write};
use url::Url; use url::Url;
#[derive( #[derive(

View file

@ -130,7 +130,9 @@ pub(crate) async fn get_activity_cached(
.await .await
.optional() .optional()
.context("could not read activity")?; .context("could not read activity")?;
let Some(mut row) = row else { return anyhow::Result::<_, anyhow::Error>::Ok(None) }; let Some(mut row) = row else {
return anyhow::Result::<_, anyhow::Error>::Ok(None);
};
// swap to avoid cloning // swap to avoid cloning
let mut data = Value::Null; let mut data = Value::Null;
std::mem::swap(&mut row.data, &mut data); std::mem::swap(&mut row.data, &mut data);

View file

@ -210,7 +210,7 @@ impl InstanceWorker {
activity activity
.send_inboxes .send_inboxes
.iter() .iter()
.filter_map(|e| e.as_ref()) .filter_map(std::option::Option::as_ref)
.filter_map(|u| (u.domain() == Some(&self.instance.domain)).then(|| u.inner().clone())), .filter_map(|u| (u.domain() == Some(&self.instance.domain)).then(|| u.inner().clone())),
); );
inbox_urls inbox_urls