Minor fix to prevent setting lastInvitedAt for invitees who weren’t actually sent an invitation

This commit is contained in:
Carlos Monastyrski
2025-07-07 15:35:49 -03:00
parent 9137fa4ca5
commit 9d39910152
+3 -1
View File
@@ -1442,6 +1442,7 @@ export const orgServiceFactory = ({
const appCfg = getConfig(); const appCfg = getConfig();
const orgCache: Record<string, { name: string; id: string } | undefined> = {}; const orgCache: Record<string, { name: string; id: string } | undefined> = {};
const notifiedUsers: string[] = [];
await Promise.all( await Promise.all(
invitedUsers.map(async (invitedUser) => { invitedUsers.map(async (invitedUser) => {
@@ -1472,11 +1473,12 @@ export const orgServiceFactory = ({
callback_url: `${appCfg.SITE_URL}/signupinvite` callback_url: `${appCfg.SITE_URL}/signupinvite`
} }
}); });
notifiedUsers.push(invitedUser.id);
} }
}) })
); );
await orgMembershipDAL.updateLastInvitedAtByIds(invitedUsers.map((u) => u.id)); await orgMembershipDAL.updateLastInvitedAtByIds(notifiedUsers);
}; };
return { return {