diff --git a/src/traits.rs b/src/traits.rs index 99e857d..c2a2c58 100644 --- a/src/traits.rs +++ b/src/traits.rs @@ -28,10 +28,16 @@ pub trait ExprChecker { impl ExprChecker for Expr { fn is_match<'a>(&'a self, user: &ForgejoUser) -> Option { let one_of = |hay: &str, exprs: &'a Vec| { - exprs.iter().find(|re| { - hay.split('\n') - .any(|line| re.re_vec.iter().all(|re| re.is_match(line.trim()))) - }) + // Join the user bio into a single line + // ref: https://git.4rs.nl/awiteb/forgejo-guardian/issues/2 + let hay = if hay.contains('\n') { + hay.split('\n').collect::>().join(" ") + } else { + hay.to_string() + }; + exprs + .iter() + .find(|re_re| re_re.re_vec.iter().all(|re| re.is_match(&hay))) }; [ one_of(&user.username, &self.usernames),