- // Do the update
- let content_slurs_removed = remove_slurs(&data.content.to_owned());
- let comment_id = data.comment_id;
- let updated_comment = blocking(context.pool(), move |conn| {
- Comment::update_content(conn, comment_id, &content_slurs_removed)
- })
- .await?
- .map_err(|_| ApiError::err("couldnt_update_comment"))?;
+ let language_id = self.language_id;
+ CommunityLanguage::is_allowed_community_language(
+ &mut context.pool(),
+ language_id,
+ orig_comment.community.id,
+ )
+ .await?;
+
+ // Update the Content
+ let content = data
+ .content
+ .as_ref()
+ .map(|c| remove_slurs(c, &local_site_to_slur_regex(&local_site)));
+ is_valid_body_field(&content, false)?;
+ let content = sanitize_html_opt(&content);