]> Untitled Git - lemmy.git/commitdiff
Convert note.content and chat_message.content to html (fixes #1871)
authorFelix Ableitner <me@nutomic.com>
Tue, 2 Nov 2021 11:49:28 +0000 (12:49 +0100)
committerFelix Ableitner <me@nutomic.com>
Tue, 2 Nov 2021 20:39:02 +0000 (21:39 +0100)
crates/apub/assets/lemmy/objects/chat_message.json
crates/apub/assets/lemmy/objects/note.json
crates/apub/src/objects/comment.rs
crates/apub/src/objects/private_message.rs

index 45790231d4b5e90ec2a6e1aef493b6a6486bd687..c639aef92af7f09f34e1c20c25b34a86ad5bc533 100644 (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",
index 2a20be29da3bf2b8be780696906fd9b42830eb3f..c353d0b2bff545f079ed3704a2c5d38f0313de74 100644 (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!",
index b5f72ca38b7f04a2c69dc57665264c8a1ef08cbf..3e3d10df30a18d8008dd57ef5d74679747499c05 100644 (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(),
index 678435eeb0136b3a1d43d100e350581a2ed143b3..81615fdc9708fb918c102d8bc7321028bf550d01 100644 (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(),