]> Untitled Git - lemmy.git/blobdiff - crates/api/src/local_user/get_captcha.rs
Make functions work with both connection and pool (#3420)
[lemmy.git] / crates / api / src / local_user / get_captcha.rs
index 92653cfc6c1c7a16ca2df8eb1b70b97861128641..5f1079ef238851deda151092208df357094ffdc3 100644 (file)
@@ -17,7 +17,7 @@ impl Perform for GetCaptcha {
 
   #[tracing::instrument(skip(context))]
   async fn perform(&self, context: &Data<LemmyContext>) -> Result<Self::Response, LemmyError> {
-    let local_site = LocalSite::read(context.pool()).await?;
+    let local_site = LocalSite::read(&mut context.pool()).await?;
 
     if !local_site.captcha_enabled {
       return Ok(GetCaptchaResponse { ok: None });
@@ -37,7 +37,7 @@ impl Perform for GetCaptcha {
 
     let captcha_form: CaptchaAnswerForm = CaptchaAnswerForm { answer };
     // Stores the captcha item in the db
-    let captcha = CaptchaAnswer::insert(context.pool(), &captcha_form).await?;
+    let captcha = CaptchaAnswer::insert(&mut context.pool(), &captcha_form).await?;
 
     Ok(GetCaptchaResponse {
       ok: Some(CaptchaResponse {