From 06718a5c8a0af6c9facd10debfadae100fd25aa2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Igor=20Gali=C4=87?= Date: Fri, 14 Sep 2018 20:25:16 +0200 Subject: [PATCH] directly use SafeString in InstanceSettingsForm --- plume-models/src/instance.rs | 2 +- src/routes/instance.rs | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/plume-models/src/instance.rs b/plume-models/src/instance.rs index a250306..8466fa6 100644 --- a/plume-models/src/instance.rs +++ b/plume-models/src/instance.rs @@ -115,7 +115,7 @@ impl Instance { )) } - pub fn update(&self, conn: &PgConnection, name: String, open_registrations: bool, short_description: String, long_description: String) -> Instance { + pub fn update(&self, conn: &PgConnection, name: String, open_registrations: bool, short_description: SafeString, long_description: SafeString) -> Instance { let (sd, _) = md_to_html(short_description.as_ref()); let (ld, _) = md_to_html(long_description.as_ref()); diesel::update(self) diff --git a/src/routes/instance.rs b/src/routes/instance.rs index 6905ecb..25f56bb 100644 --- a/src/routes/instance.rs +++ b/src/routes/instance.rs @@ -10,7 +10,9 @@ use plume_models::{ db_conn::DbConn, posts::Post, users::User, + safe_string::SafeString, instance::* + }; use inbox::Inbox; use routes::Page; @@ -110,8 +112,8 @@ struct InstanceSettingsForm { #[validate(length(min = "1"))] name: String, open_registrations: bool, - short_description: String, - long_description: String, + short_description: SafeString, + long_description: SafeString, #[validate(length(min = "1"))] default_license: String }