Avoid running cypher statement if not needed

- it just feels safer to not run a cypher statement if there is no user
  in the idsOfUsers array. Why risk notifications pointing to empty
nodes? It doesn't seem like this happens, but I'm not sure how to write
a test to verify, and why run cypher statements, if there is no need to?
This commit is contained in:
mattwr18 2020-02-18 23:19:14 +01:00
parent 54caaaaa0a
commit a346632fff

View File

@ -53,6 +53,7 @@ const postAuthorOfComment = async (commentId, { context }) => {
}
const notifyUsersOfMention = async (label, id, idsOfUsers, reason, context) => {
if (!(idsOfUsers && idsOfUsers.length)) return []
await validateNotifyUsers(label, reason)
let mentionedCypher
switch (reason) {