Fix the deletion route

This commit is contained in:
Bat 2018-09-01 16:46:23 +01:00
parent a4070f971a
commit b66e8942a9

View File

@ -178,7 +178,7 @@ fn create(blog_name: String, data: LenientForm<NewPostForm>, user: User, conn: D
} }
} }
#[post("/~/<blog_name>/<slug>/delete")] #[get("/~/<blog_name>/<slug>/delete")]
fn delete(blog_name: String, slug: String, conn: DbConn, user: User, worker: State<Pool<ThunkWorker<()>>>) -> Redirect { fn delete(blog_name: String, slug: String, conn: DbConn, user: User, worker: State<Pool<ThunkWorker<()>>>) -> Redirect {
let post = Blog::find_by_fqn(&*conn, blog_name.clone()) let post = Blog::find_by_fqn(&*conn, blog_name.clone())
.and_then(|blog| Post::find_by_slug(&*conn, slug.clone(), blog.id)); .and_then(|blog| Post::find_by_slug(&*conn, slug.clone(), blog.id));