Convert note.content and chat_message.content to html (fixes #1871)

This commit is contained in:
Felix Ableitner 2021-11-02 12:49:28 +01:00
parent 0bde2d595e
commit 1c6f74cad5
4 changed files with 9 additions and 5 deletions

View file

@ -5,7 +5,7 @@
"to": [
"https://queer.hacktivis.me/users/lanodan"
],
"content": "Hello hello, testing",
"content": "<p>Hello hello, testing</p>\n",
"mediaType": "text/html",
"source": {
"content": "Hello hello, testing",

View file

@ -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": "<p>first comment!</p>\n",
"mediaType": "text/html",
"source": {
"content": "first comment!",

View file

@ -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(),

View file

@ -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(),