From: Felix Ableitner Date: Tue, 2 Nov 2021 11:49:28 +0000 (+0100) Subject: Convert note.content and chat_message.content to html (fixes #1871) X-Git-Url: http://these/git/%7B%60/feeds/static/readmes/%7Bpost.url%7D?a=commitdiff_plain;h=1c6f74cad524c5ab49201d19df8c671761a1ddff;p=lemmy.git Convert note.content and chat_message.content to html (fixes #1871) --- diff --git a/crates/apub/assets/lemmy/objects/chat_message.json b/crates/apub/assets/lemmy/objects/chat_message.json index 45790231..c639aef9 100644 --- a/crates/apub/assets/lemmy/objects/chat_message.json +++ b/crates/apub/assets/lemmy/objects/chat_message.json @@ -5,7 +5,7 @@ "to": [ "https://queer.hacktivis.me/users/lanodan" ], - "content": "Hello hello, testing", + "content": "

Hello hello, testing

\n", "mediaType": "text/html", "source": { "content": "Hello hello, testing", diff --git a/crates/apub/assets/lemmy/objects/note.json b/crates/apub/assets/lemmy/objects/note.json index 2a20be29..c353d0b2 100644 --- a/crates/apub/assets/lemmy/objects/note.json +++ b/crates/apub/assets/lemmy/objects/note.json @@ -4,7 +4,7 @@ "attributedTo": "https://enterprise.lemmy.ml/u/picard", "to": ["https://www.w3.org/ns/activitystreams#Public"], "inReplyTo": "https://enterprise.lemmy.ml/post/55143", - "content": "first comment!", + "content": "

first comment!

\n", "mediaType": "text/html", "source": { "content": "first comment!", diff --git a/crates/apub/src/objects/comment.rs b/crates/apub/src/objects/comment.rs index b5f72ca3..3e3d10df 100644 --- a/crates/apub/src/objects/comment.rs +++ b/crates/apub/src/objects/comment.rs @@ -38,6 +38,7 @@ use crate::{ }, PostOrComment, }; +use lemmy_utils::utils::markdown_to_html; #[derive(Clone, Debug)] pub struct ApubComment(Comment); @@ -106,7 +107,7 @@ impl ApubObject for ApubComment { id: self.ap_id.to_owned().into_inner(), attributed_to: ObjectId::new(creator.actor_id), to: vec![public()], - content: self.content.clone(), + content: markdown_to_html(&self.content), media_type: Some(MediaTypeHtml::Html), source: SourceCompat::Lemmy(Source { content: self.content.clone(), diff --git a/crates/apub/src/objects/private_message.rs b/crates/apub/src/objects/private_message.rs index 678435ee..81615fdc 100644 --- a/crates/apub/src/objects/private_message.rs +++ b/crates/apub/src/objects/private_message.rs @@ -19,7 +19,10 @@ use lemmy_db_schema::{ }, traits::Crud, }; -use lemmy_utils::{utils::convert_datetime, LemmyError}; +use lemmy_utils::{ + utils::{convert_datetime, markdown_to_html}, + LemmyError, +}; use lemmy_websocket::LemmyContext; use std::ops::Deref; use url::Url; @@ -81,7 +84,7 @@ impl ApubObject for ApubPrivateMessage { id: self.ap_id.clone().into(), attributed_to: ObjectId::new(creator.actor_id), to: [ObjectId::new(recipient.actor_id)], - content: self.content.clone(), + content: markdown_to_html(&self.content), media_type: Some(MediaTypeHtml::Html), source: Some(Source { content: self.content.clone(),