X-Git-Url: http://these/git/?a=blobdiff_plain;f=crates%2Fapi_crud%2Fsrc%2Fsite%2Fcreate.rs;h=540b3c6c1518d685127029542abd6f7117e0f007;hb=92568956353f21649ed9aff68b42699c9d036f30;hp=ed433ad9de78ea49b35348158711e14c76a90866;hpb=ef9dc5d0b6f727cc78ab4df214e6e65ec77c3b9e;p=lemmy.git diff --git a/crates/api_crud/src/site/create.rs b/crates/api_crud/src/site/create.rs index ed433ad9..540b3c6c 100644 --- a/crates/api_crud/src/site/create.rs +++ b/crates/api_crud/src/site/create.rs @@ -49,7 +49,7 @@ impl PerformCrud for CreateSite { async fn perform(&self, context: &Data) -> Result { let data: &CreateSite = self; let local_user_view = local_user_view_from_jwt(&data.auth, context).await?; - let local_site = LocalSite::read(context.pool()).await?; + let local_site = LocalSite::read(&mut context.pool()).await?; // Make sure user is an admin; other types of users should not create site data... is_admin(&local_user_view)?; @@ -74,7 +74,7 @@ impl PerformCrud for CreateSite { let site_id = local_site.site_id; - Site::update(context.pool(), site_id, &site_form).await?; + Site::update(&mut context.pool(), site_id, &site_form).await?; let local_site_form = LocalSiteUpdateForm::builder() // Set the site setup to true @@ -99,7 +99,7 @@ impl PerformCrud for CreateSite { .captcha_difficulty(data.captcha_difficulty.clone()) .build(); - LocalSite::update(context.pool(), &local_site_form).await?; + LocalSite::update(&mut context.pool(), &local_site_form).await?; let local_site_rate_limit_form = LocalSiteRateLimitUpdateForm::builder() .message(data.rate_limit_message) @@ -116,12 +116,12 @@ impl PerformCrud for CreateSite { .search_per_second(data.rate_limit_search_per_second) .build(); - LocalSiteRateLimit::update(context.pool(), &local_site_rate_limit_form).await?; + LocalSiteRateLimit::update(&mut context.pool(), &local_site_rate_limit_form).await?; - let site_view = SiteView::read_local(context.pool()).await?; + let site_view = SiteView::read_local(&mut context.pool()).await?; let new_taglines = data.taglines.clone(); - let taglines = Tagline::replace(context.pool(), local_site.id, new_taglines).await?; + let taglines = Tagline::replace(&mut context.pool(), local_site.id, new_taglines).await?; let rate_limit_config = local_site_rate_limit_to_rate_limit_config(&site_view.local_site_rate_limit); @@ -183,6 +183,9 @@ fn validate_create_payload(local_site: &LocalSite, create_site: &CreateSite) -> #[cfg(test)] mod tests { + #![allow(clippy::unwrap_used)] + #![allow(clippy::indexing_slicing)] + use crate::site::create::validate_create_payload; use lemmy_api_common::site::CreateSite; use lemmy_db_schema::{source::local_site::LocalSite, ListingType, RegistrationMode};