diff --git a/src/db.rs b/src/db.rs index 9cc3ece..74734f7 100644 --- a/src/db.rs +++ b/src/db.rs @@ -406,7 +406,7 @@ impl Database { async fn create_event_type(&self) -> ServiceResult<()> { for e in &*EVENTS { - if !self.event_type_exists(&e).await? { + if !self.event_type_exists(e).await? { sqlx::query!( "INSERT INTO librepages_deploy_event_type (name) VALUES ($1) ON CONFLICT (name) DO NOTHING;", @@ -823,7 +823,7 @@ mod tests { // check if events are created for e in &*EVENTS { println!("Testing event type exists {}", e.name); - assert!(db.event_type_exists(&e).await.unwrap()); + assert!(db.event_type_exists(e).await.unwrap()); } let p = super::Register { diff --git a/src/pages/dash/home.rs b/src/pages/dash/home.rs index f7523eb..30e59ae 100644 --- a/src/pages/dash/home.rs +++ b/src/pages/dash/home.rs @@ -22,15 +22,12 @@ use serde::{Deserialize, Serialize}; use tera::Context; use super::get_auth_middleware; -use crate::ctx::api::v1::auth::Login as LoginPayload; use crate::db::Site; use crate::errors::ServiceResult; use crate::pages::errors::*; use crate::settings::Settings; use crate::AppCtx; -use crate::pages::errors::*; - use super::TemplateSiteEvent; pub use super::*; @@ -77,12 +74,7 @@ async fn get_site_data(ctx: &AppCtx, id: &Identity) -> ServiceResult. */ -use std::cell::RefCell; - use actix_identity::Identity; use actix_web::http::header; use actix_web::*; @@ -24,10 +22,8 @@ use rust_embed::RustEmbed; use serde::*; use tera::*; -use crate::pages::errors::*; use crate::settings::Settings; use crate::static_assets::ASSETS; -use crate::AppCtx; use crate::{GIT_COMMIT_HASH, VERSION}; pub mod auth; @@ -134,7 +130,7 @@ impl<'a> Footer<'a> { } } -pub async fn home(ctx: AppCtx, id: &Identity) -> HttpResponse { +pub async fn home(id: &Identity) -> HttpResponse { let location = if id.identity().is_some() { PAGES.home } else { diff --git a/src/serve.rs b/src/serve.rs index 7f29dba..7a6c0cf 100644 --- a/src/serve.rs +++ b/src/serve.rs @@ -15,7 +15,7 @@ use actix_identity::Identity; * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -use actix_web::{http::header::ContentType, web, HttpRequest, HttpResponse, Responder}; +use actix_web::{web, HttpRequest, HttpResponse, Responder}; use crate::errors::*; use crate::pages; @@ -48,7 +48,7 @@ async fn index(req: HttpRequest, ctx: AppCtx, id: Identity) -> ServiceResult