Provision subdomain for ALL new teams, add tests

This commit is contained in:
Tom Moor
2018-11-12 14:00:23 -08:00
parent b3a8d34af3
commit c60bd4260f
5 changed files with 40 additions and 17 deletions

View File

@ -61,14 +61,8 @@ router.get('slack.callback', auth({ required: false }), async ctx => {
});
if (isFirstUser) {
await team.createFirstCollection(user.id);
// attempt to give the new team the same subdomain as they use on slack
try {
await team.update({ subdomain: data.team.domain });
} catch (err) {
// subdomain was invalid or already used
}
await team.provisionFirstCollection(user.id);
await team.provisionSubdomain(data.team.domain);
}
// set cookies on response and redirect to team subdomain