From 4777176d84fbda4342d2a8450de2179e414ae0e6 Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Sat, 3 Apr 2021 18:37:06 -0700 Subject: [PATCH] fix: User afterCreate hook using deprecated column --- server/models/User.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/server/models/User.js b/server/models/User.js index 3df4f788a..94a4ffa7b 100644 --- a/server/models/User.js +++ b/server/models/User.js @@ -238,13 +238,7 @@ User.beforeSave(uploadAvatar); User.beforeCreate(setRandomJwtSecret); User.afterCreate(async (user) => { const team = await Team.findByPk(user.teamId); - - // From Slack support: - // If you wish to contact users at an email address obtained through Slack, - // you need them to opt-in through a clear and separate process. - if (user.service && user.service !== "slack") { - sendEmail("welcome", user.email, { teamUrl: team.url }); - } + sendEmail("welcome", user.email, { teamUrl: team.url }); }); // By default when a user signs up we subscribe them to email notifications @@ -267,6 +261,14 @@ User.afterCreate(async (user, options) => { }, transaction: options.transaction, }), + NotificationSetting.findOrCreate({ + where: { + userId: user.id, + teamId: user.teamId, + event: "emails.features", + }, + transaction: options.transaction, + }), ]); });