use crate::{
activities::{verify_is_public, verify_person_in_community},
check_apub_id_valid_with_strictness,
use crate::{
activities::{verify_is_public, verify_person_in_community},
check_apub_id_valid_with_strictness,
local_instance,
mentions::collect_non_local_mentions,
objects::{read_from_string_or_source, verify_is_remote_object},
local_instance,
mentions::collect_non_local_mentions,
objects::{read_from_string_or_source, verify_is_remote_object},
};
use activitystreams_kinds::{object::NoteType, public};
use chrono::NaiveDateTime;
};
use activitystreams_kinds::{object::NoteType, public};
use chrono::NaiveDateTime;
async fn delete(self, context: &LemmyContext) -> Result<(), LemmyError> {
if !self.deleted {
blocking(context.pool(), move |conn| {
async fn delete(self, context: &LemmyContext) -> Result<(), LemmyError> {
if !self.deleted {
blocking(context.pool(), move |conn| {
- Comment::update_deleted(conn, self.id, true)
+ let form = CommentUpdateForm::builder().deleted(Some(true)).build();
+ Comment::update(conn, self.id, &form)
- check_apub_id_valid_with_strictness(note.id.inner(), community.local, context.settings())?;
+ let local_site_data = blocking(context.pool(), fetch_local_site_data).await??;
+
+ check_apub_id_valid_with_strictness(
+ note.id.inner(),
+ community.local,
+ &local_site_data,
+ context.settings(),
+ )?;
verify_is_remote_object(note.id.inner(), context.settings())?;
verify_person_in_community(
¬e.attributed_to,
verify_is_remote_object(note.id.inner(), context.settings())?;
verify_person_in_community(
¬e.attributed_to,
let (post, parent_comment) = note.get_parents(context, request_counter).await?;
let content = read_from_string_or_source(¬e.content, ¬e.media_type, ¬e.source);
let (post, parent_comment) = note.get_parents(context, request_counter).await?;
let content = read_from_string_or_source(¬e.content, ¬e.media_type, ¬e.source);
- let content_slurs_removed = remove_slurs(&content, &context.settings().slur_regex());
+
+ let local_site = blocking(context.pool(), LocalSite::read).await?.ok();
+ let slur_regex = &local_site_opt_to_slur_regex(&local_site);
+ let content_slurs_removed = remove_slurs(&content, slur_regex);
Community::delete(conn, data.1.id).unwrap();
Person::delete(conn, data.0.id).unwrap();
Site::delete(conn, data.3.id).unwrap();
Community::delete(conn, data.1.id).unwrap();
Person::delete(conn, data.0.id).unwrap();
Site::delete(conn, data.3.id).unwrap();