Hide cw pictures behind a summary/details (#483)

* Hide cw pictures behind a summary/details
* refactor md_to_html a bit and add cw support
* use random id for cw checkbox
This commit is contained in:
fdb-hiroshima
2019-04-06 19:20:33 +02:00
committed by GitHub
parent eabe73ddc0
commit 12c2078c89
11 changed files with 239 additions and 63 deletions
+13 -2
View File
@@ -3,6 +3,7 @@ use diesel::{self, ExpressionMethods, QueryDsl, RunQueryDsl};
use std::iter::Iterator;
use ap_url;
use medias::Media;
use plume_common::utils::md_to_html;
use safe_string::SafeString;
use schema::{instances, users};
@@ -128,8 +129,18 @@ impl Instance {
short_description: SafeString,
long_description: SafeString,
) -> Result<()> {
let (sd, _, _) = md_to_html(short_description.as_ref(), &self.public_domain, true);
let (ld, _, _) = md_to_html(long_description.as_ref(), &self.public_domain, false);
let (sd, _, _) = md_to_html(
short_description.as_ref(),
&self.public_domain,
true,
Some(Media::get_media_processor(conn, vec![])),
);
let (ld, _, _) = md_to_html(
long_description.as_ref(),
&self.public_domain,
false,
Some(Media::get_media_processor(conn, vec![])),
);
diesel::update(self)
.set((
instances::name.eq(name),