mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-11-23 04:41:19 +00:00
Convert note.content and chat_message.content to html (fixes #1871)
This commit is contained in:
parent
0bde2d595e
commit
1c6f74cad5
4 changed files with 9 additions and 5 deletions
|
@ -5,7 +5,7 @@
|
||||||
"to": [
|
"to": [
|
||||||
"https://queer.hacktivis.me/users/lanodan"
|
"https://queer.hacktivis.me/users/lanodan"
|
||||||
],
|
],
|
||||||
"content": "Hello hello, testing",
|
"content": "<p>Hello hello, testing</p>\n",
|
||||||
"mediaType": "text/html",
|
"mediaType": "text/html",
|
||||||
"source": {
|
"source": {
|
||||||
"content": "Hello hello, testing",
|
"content": "Hello hello, testing",
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
"attributedTo": "https://enterprise.lemmy.ml/u/picard",
|
"attributedTo": "https://enterprise.lemmy.ml/u/picard",
|
||||||
"to": ["https://www.w3.org/ns/activitystreams#Public"],
|
"to": ["https://www.w3.org/ns/activitystreams#Public"],
|
||||||
"inReplyTo": "https://enterprise.lemmy.ml/post/55143",
|
"inReplyTo": "https://enterprise.lemmy.ml/post/55143",
|
||||||
"content": "first comment!",
|
"content": "<p>first comment!</p>\n",
|
||||||
"mediaType": "text/html",
|
"mediaType": "text/html",
|
||||||
"source": {
|
"source": {
|
||||||
"content": "first comment!",
|
"content": "first comment!",
|
||||||
|
|
|
@ -38,6 +38,7 @@ use crate::{
|
||||||
},
|
},
|
||||||
PostOrComment,
|
PostOrComment,
|
||||||
};
|
};
|
||||||
|
use lemmy_utils::utils::markdown_to_html;
|
||||||
|
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub struct ApubComment(Comment);
|
pub struct ApubComment(Comment);
|
||||||
|
@ -106,7 +107,7 @@ impl ApubObject for ApubComment {
|
||||||
id: self.ap_id.to_owned().into_inner(),
|
id: self.ap_id.to_owned().into_inner(),
|
||||||
attributed_to: ObjectId::new(creator.actor_id),
|
attributed_to: ObjectId::new(creator.actor_id),
|
||||||
to: vec![public()],
|
to: vec![public()],
|
||||||
content: self.content.clone(),
|
content: markdown_to_html(&self.content),
|
||||||
media_type: Some(MediaTypeHtml::Html),
|
media_type: Some(MediaTypeHtml::Html),
|
||||||
source: SourceCompat::Lemmy(Source {
|
source: SourceCompat::Lemmy(Source {
|
||||||
content: self.content.clone(),
|
content: self.content.clone(),
|
||||||
|
|
|
@ -19,7 +19,10 @@ use lemmy_db_schema::{
|
||||||
},
|
},
|
||||||
traits::Crud,
|
traits::Crud,
|
||||||
};
|
};
|
||||||
use lemmy_utils::{utils::convert_datetime, LemmyError};
|
use lemmy_utils::{
|
||||||
|
utils::{convert_datetime, markdown_to_html},
|
||||||
|
LemmyError,
|
||||||
|
};
|
||||||
use lemmy_websocket::LemmyContext;
|
use lemmy_websocket::LemmyContext;
|
||||||
use std::ops::Deref;
|
use std::ops::Deref;
|
||||||
use url::Url;
|
use url::Url;
|
||||||
|
@ -81,7 +84,7 @@ impl ApubObject for ApubPrivateMessage {
|
||||||
id: self.ap_id.clone().into(),
|
id: self.ap_id.clone().into(),
|
||||||
attributed_to: ObjectId::new(creator.actor_id),
|
attributed_to: ObjectId::new(creator.actor_id),
|
||||||
to: [ObjectId::new(recipient.actor_id)],
|
to: [ObjectId::new(recipient.actor_id)],
|
||||||
content: self.content.clone(),
|
content: markdown_to_html(&self.content),
|
||||||
media_type: Some(MediaTypeHtml::Html),
|
media_type: Some(MediaTypeHtml::Html),
|
||||||
source: Some(Source {
|
source: Some(Source {
|
||||||
content: self.content.clone(),
|
content: self.content.clone(),
|
||||||
|
|
Loading…
Reference in a new issue