Merge pull request #491 from outline/jori/email-queue

Added task queue for emails
This commit is contained in:
Jori Lallo
2017-12-25 05:38:40 -08:00
committed by GitHub
5 changed files with 168 additions and 17 deletions

View File

@ -5,7 +5,7 @@ import uuid from 'uuid';
import JWT from 'jsonwebtoken';
import { DataTypes, sequelize, encryptedFields } from '../sequelize';
import { uploadToS3FromUrl } from '../utils/s3';
import mailer from '../mailer';
import { sendEmail } from '../mailer';
const BCRYPT_COST = process.env.NODE_ENV !== 'production' ? 4 : 12;
@ -99,6 +99,6 @@ const hashPassword = function hashPassword(model) {
User.beforeCreate(hashPassword);
User.beforeUpdate(hashPassword);
User.beforeCreate(setRandomJwtSecret);
User.afterCreate(user => mailer.welcome(user.email));
User.afterCreate(user => sendEmail('welcome', user.email));
export default User;