Use Blog::slug() to determine blog's slug

This commit is contained in:
Kitaiti Makoto 2022-05-20 01:51:16 +09:00
parent 4dfe300ee3
commit 393f8e5e0c

View file

@ -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()