mirror of
https://github.com/outline/outline.git
synced 2026-11-24 23:00:18 +03:00
fix: Handle deleted user or team in UserCreatedProcessor (#12839)
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
1 parent
54be0a9db3
commit
e237e6df47
1 file changed
+7
-2
@@ -11,10 +11,15 @@ export default class UserCreatedProcessor extends BaseProcessor {
|
||||
|
||||
async perform(event: UserEvent) {
|
||||
const [user, team] = await Promise.all([
|
||||
User.findByPk(event.userId, { rejectOnEmpty: true }),
|
||||
Team.findByPk(event.teamId, { rejectOnEmpty: true }),
|
||||
User.findByPk(event.userId),
|
||||
Team.findByPk(event.teamId),
|
||||
]);
|
||||
|
||||
// The user or team may have been deleted before this event is processed.
|
||||
if (!user || !team) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Invited users receive an InviteEmail at invite time, and a WelcomeEmail
|
||||
// when they accept the invite and sign in for the first time.
|
||||
if (event.name === "users.create" && user.isInvited) {
|
||||
|
||||
Reference in new issue
Block a user