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
+3 -2
View File
@@ -17,11 +17,12 @@ use models::{
users::User
};
use schema::comments;
use safe_string::SafeString;
#[derive(Queryable, Identifiable, Serialize, Clone)]
pub struct Comment {
pub id: i32,
pub content: String,
pub content: SafeString,
pub in_response_to_id: Option<i32>,
pub post_id: i32,
pub author_id: i32,
@@ -34,7 +35,7 @@ pub struct Comment {
#[derive(Insertable)]
#[table_name = "comments"]
pub struct NewComment {
pub content: String,
pub content: SafeString,
pub in_response_to_id: Option<i32>,
pub post_id: i32,
pub author_id: i32,
+3 -2
View File
@@ -19,6 +19,7 @@ use models::{
users::User
};
use schema::posts;
use safe_string::SafeString;
#[derive(Queryable, Identifiable, Serialize)]
pub struct Post {
@@ -26,7 +27,7 @@ pub struct Post {
pub blog_id: i32,
pub slug: String,
pub title: String,
pub content: String,
pub content: SafeString,
pub published: bool,
pub license: String,
pub creation_date: NaiveDateTime,
@@ -39,7 +40,7 @@ pub struct NewPost {
pub blog_id: i32,
pub slug: String,
pub title: String,
pub content: String,
pub content: SafeString,
pub published: bool,
pub license: String,
pub ap_url: String