From 1d971045ee298f97a536d9eb3e15ee0c04c6ada0 Mon Sep 17 00:00:00 2001 From: Chris Brame Date: Thu, 8 Aug 2019 03:00:24 -0400 Subject: [PATCH] fix(mailcheck): #251 - Not creating ticket due to invalid group --- src/mailer/mailCheck.js | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/mailer/mailCheck.js b/src/mailer/mailCheck.js index aa4a6e523..b29d789ff 100644 --- a/src/mailer/mailCheck.js +++ b/src/mailer/mailCheck.js @@ -285,7 +285,23 @@ function handleMessages (messages) { message.group = group } - return callback(null, group) + if (!message.group) { + groupSchema.create( + { + name: message.owner.email, + members: [message.owner._id], + sendMailTo: [message.owner._id], + public: true + }, + function (err, group) { + if (err) return callback(err) + message.group = group + return callback(null, group) + } + ) + } else { + return callback(null, group) + } }) } ],