Receiver key is always an anchored regex match

This commit is contained in:
stuart nelson 2017-04-24 14:54:25 +02:00
parent dc90e8dec3
commit b29afb80a2
1 changed files with 5 additions and 9 deletions

View File

@ -26,15 +26,11 @@ alertsParser =
(\filter receiver silenced ->
let
parsed =
case receiver of
Nothing ->
Nothing
Just receiver ->
if String.startsWith "~" receiver then
Just { key = "receiver", op = RegexMatch, value = String.dropLeft 1 receiver }
else
Just { key = "receiver", op = Eq, value = receiver }
Maybe.map
(\r ->
{ key = "receiver", op = RegexMatch, value = "^(?:" ++ r ++ ")$" }
)
receiver
in
Filter filter parsed silenced
)