make hashtags work in profile summary (#562)

* make hashtags work in profile summary

fix #541

* cargo fmt
This commit is contained in:
fdb-hiroshima
2019-05-04 17:33:50 +02:00
committed by GitHub
parent c9070930d2
commit c52aac012c
9 changed files with 36 additions and 25 deletions
+1 -1
View File
@@ -107,7 +107,7 @@ impl Comment {
let author = User::get(&c.conn, self.author_id)?;
let (html, mentions, _hashtags) = utils::md_to_html(
self.content.get().as_ref(),
&Instance::get_local(&c.conn)?.public_domain,
Some(&Instance::get_local(&c.conn)?.public_domain),
true,
Some(Media::get_media_processor(&c.conn, vec![&author])),
);
+2 -2
View File
@@ -131,13 +131,13 @@ impl Instance {
) -> Result<()> {
let (sd, _, _) = md_to_html(
short_description.as_ref(),
&self.public_domain,
Some(&self.public_domain),
true,
Some(Media::get_media_processor(conn, vec![])),
);
let (ld, _, _) = md_to_html(
long_description.as_ref(),
&self.public_domain,
Some(&self.public_domain),
false,
Some(Media::get_media_processor(conn, vec![])),
);
+2 -2
View File
@@ -692,7 +692,7 @@ impl FromId<PlumeRocket> for Post {
}
// save mentions and tags
let mut hashtags = md_to_html(&post.source, "", false, None)
let mut hashtags = md_to_html(&post.source, None, false, None)
.2
.into_iter()
.map(|s| s.to_camel_case())
@@ -829,7 +829,7 @@ impl AsObject<User, Update, &PlumeRocket> for PostUpdate {
post.license = license;
}
let mut txt_hashtags = md_to_html(&post.source, "", false, None)
let mut txt_hashtags = md_to_html(&post.source, None, false, None)
.2
.into_iter()
.map(|s| s.to_camel_case())
+2 -2
View File
@@ -215,7 +215,7 @@ impl User {
users::email.eq(email),
users::summary_html.eq(utils::md_to_html(
&summary,
"",
None,
false,
Some(Media::get_media_processor(conn, vec![self])),
)
@@ -931,7 +931,7 @@ impl NewUser {
display_name,
is_admin,
summary: summary.to_owned(),
summary_html: SafeString::new(&utils::md_to_html(&summary, "", false, None).0),
summary_html: SafeString::new(&utils::md_to_html(&summary, None, false, None).0),
email: Some(email),
hashed_password: Some(password),
instance_id: Instance::get_local(conn)?.id,