Fixes: Welcome email dashboard location (#886)

* Fixes: Welcome email dashboard location
Updated logo in email

* 💚
This commit is contained in:
Tom Moor
2019-01-27 12:30:53 +00:00
committed by GitHub
parent 1a6a7d04e5
commit 476bab9333
8 changed files with 25 additions and 17 deletions

View File

@@ -6,7 +6,7 @@ import subMinutes from 'date-fns/sub_minutes';
import { DataTypes, sequelize, encryptedFields } from '../sequelize';
import { publicS3Endpoint, uploadToS3FromUrl } from '../utils/s3';
import { sendEmail } from '../mailer';
import { Star, Collection, NotificationSetting, ApiKey } from '.';
import { Star, Team, Collection, NotificationSetting, ApiKey } from '.';
const User = sequelize.define(
'user',
@@ -158,7 +158,10 @@ User.beforeDestroy(checkLastAdmin);
User.beforeDestroy(removeIdentifyingInfo);
User.beforeSave(uploadAvatar);
User.beforeCreate(setRandomJwtSecret);
User.afterCreate(user => sendEmail('welcome', user.email));
User.afterCreate(async user => {
const team = await Team.findById(user.teamId);
sendEmail('welcome', user.email, { teamUrl: team.url });
});
// By default when a user signs up we subscribe them to email notifications
// when documents they created are edited by other team members and onboarding