- async fn from_apub(
- note: Note,
- context: &LemmyContext,
- request_counter: &mut i32,
- ) -> Result<ApubComment, LemmyError> {
- let creator = note
- .attributed_to
- .dereference(context, context.client(), request_counter)
- .await?;
- let (post, parent_comment_id) = note.get_parents(context, request_counter).await?;
-
- let content = read_from_string_or_source(¬e.content, ¬e.source);
- let content_slurs_removed = remove_slurs(&content, &context.settings().slur_regex());
-
- let form = CommentForm {
+ async fn from_json(note: Note, context: &Data<LemmyContext>) -> Result<ApubComment, LemmyError> {
+ let creator = note.attributed_to.dereference(context).await?;
+ let (post, parent_comment) = note.get_parents(context).await?;
+
+ let content = read_from_string_or_source(¬e.content, ¬e.media_type, ¬e.source);
+
+ let local_site = LocalSite::read(&mut context.pool()).await.ok();
+ let slur_regex = &local_site_opt_to_slur_regex(&local_site);
+ let content = remove_slurs(&content, slur_regex);
+ let content = sanitize_html(&content);
+ let language_id =
+ LanguageTag::to_language_id_single(note.language, &mut context.pool()).await?;
+
+ let form = CommentInsertForm {