fix: Split the haystack lines
Match each line separately Signed-off-by: Awiteb <a@4rs.nl>
This commit is contained in:
parent
ff7994686d
commit
880330576d
1 changed files with 5 additions and 1 deletions
|
@ -26,7 +26,11 @@ pub trait ExprChecker {
|
|||
|
||||
impl ExprChecker for Expr {
|
||||
fn is_match<'a>(&'a self, user: &ForgejoUser) -> Option<Regex> {
|
||||
let one_of = |hay, exprs: &'a Vec<Regex>| exprs.iter().find(|re| re.is_match(hay));
|
||||
let one_of = |hay: &str, exprs: &'a Vec<Regex>| {
|
||||
exprs
|
||||
.iter()
|
||||
.find(|re| hay.split('\n').any(|line| re.is_match(line.trim())))
|
||||
};
|
||||
[
|
||||
one_of(&user.username, &self.usernames),
|
||||
one_of(&user.full_name, &self.full_names),
|
||||
|
|
Loading…
Reference in a new issue