From 393f8e5e0cc4e66138e342a131ac68a85e56d786 Mon Sep 17 00:00:00 2001 From: Kitaiti Makoto Date: Fri, 20 May 2022 01:51:16 +0900 Subject: [PATCH] Use Blog::slug() to determine blog's slug --- src/routes/blogs.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/routes/blogs.rs b/src/routes/blogs.rs index 99c63bf3..1e2c9636 100644 --- a/src/routes/blogs.rs +++ b/src/routes/blogs.rs @@ -79,7 +79,7 @@ pub struct NewBlogForm { } fn valid_slug(title: &str) -> Result<(), ValidationError> { - let slug = utils::make_actor_id(title); + let slug = Blog::slug(title); if slug.is_empty() { Err(ValidationError::new("empty_slug")) } else { @@ -93,7 +93,7 @@ pub fn create( conn: DbConn, rockets: PlumeRocket, ) -> RespondOrRedirect { - let slug = utils::make_actor_id(&form.title); + let slug = Blog::slug(&form.title); let intl = &rockets.intl.catalog; let user = rockets.user.clone().unwrap(); @@ -122,7 +122,7 @@ pub fn create( let blog = Blog::insert( &conn, NewBlog::new_local( - slug.clone(), + slug.into(), form.title.to_string(), String::from(""), Instance::get_local()