From 9d54354af4254ce6d8ca82f5a45ad484d650d447 Mon Sep 17 00:00:00 2001 From: dull b Date: Fri, 30 Jun 2023 05:13:56 +0000 Subject: [PATCH] Fix stuff broken by merge --- crates/api/src/local_user/get_captcha.rs | 2 +- crates/api/src/local_user/reset_password.rs | 2 +- crates/db_schema/src/impls/comment.rs | 2 +- crates/db_schema/src/impls/password_reset_request.rs | 3 +-- crates/db_schema/src/impls/post.rs | 6 +++--- 5 files changed, 7 insertions(+), 8 deletions(-) diff --git a/crates/api/src/local_user/get_captcha.rs b/crates/api/src/local_user/get_captcha.rs index 133044248..8ee785fcd 100644 --- a/crates/api/src/local_user/get_captcha.rs +++ b/crates/api/src/local_user/get_captcha.rs @@ -17,7 +17,7 @@ impl Perform for GetCaptcha { #[tracing::instrument(skip(context))] async fn perform(&self, context: &Data) -> Result { - let local_site = LocalSite::read(context.pool()).await?; + let local_site = LocalSite::read(&mut *context.conn().await?).await?; if !local_site.captcha_enabled { return Ok(GetCaptchaResponse { ok: None }); diff --git a/crates/api/src/local_user/reset_password.rs b/crates/api/src/local_user/reset_password.rs index cf65f94eb..d0072f6cd 100644 --- a/crates/api/src/local_user/reset_password.rs +++ b/crates/api/src/local_user/reset_password.rs @@ -28,7 +28,7 @@ impl Perform for PasswordReset { // Check for too many attempts (to limit potential abuse) let recent_resets_count = PasswordResetRequest::get_recent_password_resets_count( - context.pool(), + &mut *context.conn().await?, local_user_view.local_user.id, ) .await?; diff --git a/crates/db_schema/src/impls/comment.rs b/crates/db_schema/src/impls/comment.rs index 39ef2986a..4150c1348 100644 --- a/crates/db_schema/src/impls/comment.rs +++ b/crates/db_schema/src/impls/comment.rs @@ -11,7 +11,7 @@ use crate::{ CommentUpdateForm, }, traits::{Crud, Likeable, Saveable}, - utils::{get_conn, naive_now, DbConn, DELETED_REPLACEMENT_TEXT}, + utils::{naive_now, DbConn, DELETED_REPLACEMENT_TEXT}, }; use diesel::{ dsl::{insert_into, sql_query}, diff --git a/crates/db_schema/src/impls/password_reset_request.rs b/crates/db_schema/src/impls/password_reset_request.rs index d5e050c60..a7737e719 100644 --- a/crates/db_schema/src/impls/password_reset_request.rs +++ b/crates/db_schema/src/impls/password_reset_request.rs @@ -80,10 +80,9 @@ impl PasswordResetRequest { } pub async fn get_recent_password_resets_count( - pool: &DbPool, + conn: &mut DbConn, user_id: LocalUserId, ) -> Result { - let conn = &mut get_conn(pool).await?; password_reset_request .filter(local_user_id.eq(user_id)) .filter(published.gt(now - 1.days())) diff --git a/crates/db_schema/src/impls/post.rs b/crates/db_schema/src/impls/post.rs index 99b49b190..10b8f0e47 100644 --- a/crates/db_schema/src/impls/post.rs +++ b/crates/db_schema/src/impls/post.rs @@ -27,7 +27,7 @@ use crate::{ PostUpdateForm, }, traits::{Crud, Likeable, Readable, Saveable}, - utils::{get_conn, naive_now, DbConn, DbPool, DELETED_REPLACEMENT_TEXT, FETCH_LIMIT_MAX}, + utils::{naive_now, DbConn, DELETED_REPLACEMENT_TEXT, FETCH_LIMIT_MAX}, }; use ::url::Url; use diesel::{dsl::insert_into, result::Error, ExpressionMethods, QueryDsl, TextExpressionMethods}; @@ -103,8 +103,8 @@ impl Post { conn: &mut DbConn, for_creator_id: PersonId, ) -> Result, Error> { - let perma_deleted = "*Permananently Deleted*"; - let perma_deleted_url = "https://deleted.com"; + let _perma_deleted = "*Permananently Deleted*"; + let _perma_deleted_url = "https://deleted.com"; diesel::update(post.filter(creator_id.eq(for_creator_id))) .set((