diff --git a/src/alerts.js b/src/alerts.js index 7a8c8ade..8d604261 100755 --- a/src/alerts.js +++ b/src/alerts.js @@ -11,7 +11,7 @@ async function addAlert(alert, sessionUser) { throw new HttpError('You are not authenthicated', 401); } - if (!alert.actors?.length > 0 && !alert.tags?.length > 0 && !alert.entity && !alert.matches?.length > 0) { + if ((!alert.actors || alert.actors.length === 0) && (!alert.tags || alert.tags.length === 0) && (!alert.entities || alert.entities.length === 0) && (!alert.matches || alert.matches.length === 0)) { throw new HttpError('Alert must contain at least one actor, tag or entity', 400); }