]> Untitled Git - lemmy.git/blobdiff - crates/apub/src/objects/person.rs
Cache & Optimize Woodpecker CI (#3450)
[lemmy.git] / crates / apub / src / objects / person.rs
index 95a4fd202342d33cc0b78ccb93b6032eb6a071d3..d28f8c7cf335982d07b74753ea447c9c06eed703 100644 (file)
@@ -69,7 +69,7 @@ impl Object for ApubPerson {
     context: &Data<Self::DataType>,
   ) -> Result<Option<Self>, LemmyError> {
     Ok(
-      DbPerson::read_from_apub_id(context.pool(), &object_id.into())
+      DbPerson::read_from_apub_id(&mut context.pool(), &object_id.into())
         .await?
         .map(Into::into),
     )
@@ -78,7 +78,7 @@ impl Object for ApubPerson {
   #[tracing::instrument(skip_all)]
   async fn delete(self, context: &Data<Self::DataType>) -> Result<(), LemmyError> {
     let form = PersonUpdateForm::builder().deleted(Some(true)).build();
-    DbPerson::update(context.pool(), self.id, &form).await?;
+    DbPerson::update(&mut context.pool(), self.id, &form).await?;
     Ok(())
   }
 
@@ -118,7 +118,7 @@ impl Object for ApubPerson {
     expected_domain: &Url,
     context: &Data<Self::DataType>,
   ) -> Result<(), LemmyError> {
-    let local_site_data = local_site_data_cached(context.pool()).await?;
+    let local_site_data = local_site_data_cached(&mut context.pool()).await?;
     let slur_regex = &local_site_opt_to_slur_regex(&local_site_data.local_site);
     check_slurs(&person.preferred_username, slur_regex)?;
     check_slurs_opt(&person.name, slur_regex)?;
@@ -165,7 +165,7 @@ impl Object for ApubPerson {
       matrix_user_id: person.matrix_user_id,
       instance_id,
     };
-    let person = DbPerson::upsert(context.pool(), &person_form).await?;
+    let person = DbPerson::upsert(&mut context.pool(), &person_form).await?;
 
     Ok(person.into())
   }
@@ -195,6 +195,9 @@ impl Actor for ApubPerson {
 
 #[cfg(test)]
 pub(crate) mod tests {
+  #![allow(clippy::unwrap_used)]
+  #![allow(clippy::indexing_slicing)]
+
   use super::*;
   use crate::{
     objects::{
@@ -256,7 +259,9 @@ pub(crate) mod tests {
   }
 
   async fn cleanup(data: (ApubPerson, ApubSite), context: &LemmyContext) {
-    DbPerson::delete(context.pool(), data.0.id).await.unwrap();
-    Site::delete(context.pool(), data.1.id).await.unwrap();
+    DbPerson::delete(&mut context.pool(), data.0.id)
+      .await
+      .unwrap();
+    Site::delete(&mut context.pool(), data.1.id).await.unwrap();
   }
 }