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
+15 -1
View File
@@ -280,7 +280,21 @@ pub fn update(
blog.title = form.title.clone();
blog.summary = form.summary.clone();
blog.summary_html = SafeString::new(&utils::md_to_html(&form.summary, "", true).0);
blog.summary_html = SafeString::new(
&utils::md_to_html(
&form.summary,
"",
true,
Some(Media::get_media_processor(
&conn,
blog.list_authors(&conn)
.expect("Couldn't get list of authors")
.iter()
.collect(),
)),
)
.0,
);
blog.icon_id = form.icon;
blog.banner_id = form.banner;
blog.save_changes::<Blog>(&*conn)
+3 -2
View File
@@ -15,8 +15,8 @@ use plume_common::{
utils,
};
use plume_models::{
blogs::Blog, comments::*, db_conn::DbConn, instance::Instance, mentions::Mention, posts::Post,
safe_string::SafeString, tags::Tag, users::User,
blogs::Blog, comments::*, db_conn::DbConn, instance::Instance, medias::Media,
mentions::Mention, posts::Post, safe_string::SafeString, tags::Tag, users::User,
};
use routes::errors::ErrorPage;
use Worker;
@@ -49,6 +49,7 @@ pub fn create(
.expect("comments::create: local instance error")
.public_domain,
true,
Some(Media::get_media_processor(&conn, vec![&user])),
);
let comm = Comment::insert(
&*conn,
+14
View File
@@ -264,6 +264,13 @@ pub fn update(
.expect("posts::update: Error getting local instance")
.public_domain,
false,
Some(Media::get_media_processor(
&conn,
b.list_authors(&conn)
.expect("Could not get author list")
.iter()
.collect(),
)),
);
// update publication date if when this article is no longer a draft
@@ -424,6 +431,13 @@ pub fn create(
.expect("post::create: local instance error")
.public_domain,
false,
Some(Media::get_media_processor(
&conn,
blog.list_authors(&conn)
.expect("Could not get author list")
.iter()
.collect(),
)),
);
let searcher = rockets.searcher;