Re-export ammonia::clean_text from utils::html

This commit is contained in:
silverpill 2023-02-12 21:38:22 +00:00
parent 2acf50fa01
commit c461fbc268
2 changed files with 4 additions and 4 deletions

View file

@ -1,12 +1,10 @@
use ammonia::clean_text;
use crate::activitypub::identifiers::{local_actor_id, local_object_id};
use crate::config::Instance;
use crate::models::posts::types::Post;
use crate::models::profiles::types::DbActorProfile;
use crate::utils::{
datetime::get_min_datetime,
html::clean_html_all,
html::{clean_html_all, escape_html},
};
const ENTRY_TITLE_MAX_LENGTH: usize = 75;
@ -16,7 +14,7 @@ fn make_entry(
post: &Post,
) -> String {
let object_id = local_object_id(instance_url, &post.id);
let content_escaped = clean_text(&post.content);
let content_escaped = escape_html(&post.content);
let content_cleaned = clean_html_all(&post.content);
// Use trimmed content for title
let mut title: String = content_cleaned.chars()

View file

@ -3,6 +3,8 @@ use std::iter::FromIterator;
use ammonia::Builder;
pub use ammonia::{clean_text as escape_html};
pub fn clean_html(
unsafe_html: &str,
allowed_classes: Vec<(&'static str, Vec<&'static str>)>,