change post.content and comment.content's types from String to SafeString

This commit is contained in:
Trinity Pointard
2018-06-11 12:21:34 +02:00
committed by Your Name
parent bb1442db8a
commit 7d9609671c
8 changed files with 148 additions and 8 deletions
+2 -1
View File
@@ -13,6 +13,7 @@ use models::{
};
use utils;
use safe_string::SafeString;
#[get("/~/<_blog>/<slug>/comment")]
fn new(_blog: String, slug: String, user: User, conn: DbConn) -> Template {
@@ -43,7 +44,7 @@ fn create(blog: String, slug: String, query: CommentQuery, data: Form<NewComment
let post = Post::find_by_slug(&*conn, slug.clone()).unwrap();
let form = data.get();
let comment = Comment::insert(&*conn, NewComment {
content: form.content.clone(),
content: SafeString::new(&form.content.clone()),
in_response_to_id: query.responding_to,
post_id: post.id,
author_id: user.id,