diff --git a/.gitignore b/.gitignore index 95b863a..15c0ef7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ config.json node_modules +.history +.env \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index a236081..6231ba0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,7 +14,7 @@ "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.4.tgz", "integrity": "sha1-hiRnWMfdbSGmR0/whKR0DsBesh8=", "requires": { - "mime-types": "2.1.17", + "mime-types": "~2.1.16", "negotiator": "0.6.1" } }, diff --git a/routes/invite.js b/routes/invite.js index 9013fd4..e226336 100644 --- a/routes/invite.js +++ b/routes/invite.js @@ -24,6 +24,10 @@ module.exports = function (app) { res.status(400).send('already_invited'); } + function alreadyInTeam() { + res.status(400).send("already_in_team"); + } + slack .createInvite(req.body.email) .then(function() { @@ -45,7 +49,9 @@ module.exports = function (app) { if(err === 'already_invited') { return alreadyInvited(req.body.email); } - + if (err === "already_in_team") { + return alreadyInTeam(); + } var message = 'Creating automatic invitation failed for: ' + req.body.email + ' reason: ' + err; slack.createMessage(message);