Skip to content

Commit

Permalink
fix(mailcheck): #251 - Not creating ticket due to invalid group
Browse files Browse the repository at this point in the history
  • Loading branch information
polonel committed Aug 8, 2019
1 parent 299edb4 commit 1d97104
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/mailer/mailCheck.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
})
}
],
Expand Down

0 comments on commit 1d97104

Please sign in to comment.