Skip to content

Commit

Permalink
fix 8
Browse files Browse the repository at this point in the history
  • Loading branch information
callmeclover committed Apr 23, 2024
1 parent e42df7b commit 573af32
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/message/func.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ pub fn into_censored_md(html: &str, user: &mut User) -> Result<String, Box<dyn E

let nodes_text: Vec<String> = document.descendants().text_nodes().map(|text| {<RefCell<String> as Clone>::clone(&text).into_inner()}).collect();
let mut nodes_char: Vec<char>;
match user.glass.process(&nodes_text.join("")) {
match &user.glass.process(&nodes_text.join("")) {
Ok(val) => { nodes_char = val.chars().collect() },
Err(err) => { return Err(err); }
}
Expand Down
4 changes: 2 additions & 2 deletions src/user/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ impl GlassModeration {
/// This will add reports if it finds Type::OFFENSIVE, returning an error.
/// If it finds no Type::OFFENSIVE, but Type::EVASIVE, it will instead warn the user.
/// If the user is muted, it returns an error.
pub fn process(&mut self, input: &str) -> Result<&str, Box<dyn Error>> {
pub fn process(&mut self, input: &str) -> Result<String, Box<dyn Error>> {
if self.is_muted { return Err("User is muted".into()); }

let (censored, analysis) = Censor::from_str(input)
Expand All @@ -58,7 +58,7 @@ impl GlassModeration {
if analysis.is(Type::EVASIVE) {
self.warn();
}
Ok(&censored)
Ok(censored)
}
}

Expand Down

0 comments on commit 573af32

Please sign in to comment.