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
+5 -2
View File
@@ -11,6 +11,7 @@ use std::collections::HashSet;
use comment_seers::{CommentSeers, NewCommentSeers};
use instance::Instance;
use medias::Media;
use mentions::Mention;
use notifications::*;
use plume_common::activity_pub::{
@@ -102,14 +103,16 @@ impl Comment {
.unwrap_or(false)
}
pub fn to_activity(&self, conn: &Connection) -> Result<Note> {
pub fn to_activity<'b>(&self, conn: &'b Connection) -> Result<Note> {
let author = User::get(conn, self.author_id)?;
let (html, mentions, _hashtags) = utils::md_to_html(
self.content.get().as_ref(),
&Instance::get_local(conn)?.public_domain,
true,
Some(Media::get_media_processor(conn, vec![&author])),
);
let author = User::get(conn, self.author_id)?;
let mut note = Note::default();
let to = vec![Id::new(PUBLIC_VISIBILTY.to_string())];