Re-export ammonia::clean_text from utils::html
This commit is contained in:
parent
2acf50fa01
commit
c461fbc268
2 changed files with 4 additions and 4 deletions
|
@ -1,12 +1,10 @@
|
||||||
use ammonia::clean_text;
|
|
||||||
|
|
||||||
use crate::activitypub::identifiers::{local_actor_id, local_object_id};
|
use crate::activitypub::identifiers::{local_actor_id, local_object_id};
|
||||||
use crate::config::Instance;
|
use crate::config::Instance;
|
||||||
use crate::models::posts::types::Post;
|
use crate::models::posts::types::Post;
|
||||||
use crate::models::profiles::types::DbActorProfile;
|
use crate::models::profiles::types::DbActorProfile;
|
||||||
use crate::utils::{
|
use crate::utils::{
|
||||||
datetime::get_min_datetime,
|
datetime::get_min_datetime,
|
||||||
html::clean_html_all,
|
html::{clean_html_all, escape_html},
|
||||||
};
|
};
|
||||||
|
|
||||||
const ENTRY_TITLE_MAX_LENGTH: usize = 75;
|
const ENTRY_TITLE_MAX_LENGTH: usize = 75;
|
||||||
|
@ -16,7 +14,7 @@ fn make_entry(
|
||||||
post: &Post,
|
post: &Post,
|
||||||
) -> String {
|
) -> String {
|
||||||
let object_id = local_object_id(instance_url, &post.id);
|
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);
|
let content_cleaned = clean_html_all(&post.content);
|
||||||
// Use trimmed content for title
|
// Use trimmed content for title
|
||||||
let mut title: String = content_cleaned.chars()
|
let mut title: String = content_cleaned.chars()
|
||||||
|
|
|
@ -3,6 +3,8 @@ use std::iter::FromIterator;
|
||||||
|
|
||||||
use ammonia::Builder;
|
use ammonia::Builder;
|
||||||
|
|
||||||
|
pub use ammonia::{clean_text as escape_html};
|
||||||
|
|
||||||
pub fn clean_html(
|
pub fn clean_html(
|
||||||
unsafe_html: &str,
|
unsafe_html: &str,
|
||||||
allowed_classes: Vec<(&'static str, Vec<&'static str>)>,
|
allowed_classes: Vec<(&'static str, Vec<&'static str>)>,
|
||||||
|
|
Loading…
Reference in a new issue