fix: User afterCreate hook using deprecated column
This commit is contained in:
@ -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 });
|
||||
}
|
||||
});
|
||||
|
||||
// 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,
|
||||
}),
|
||||
]);
|
||||
});
|
||||
|
||||
|
Reference in New Issue
Block a user