Skip to content

Commit 24d6ed3

Browse files
committed
fix(kilo-pass): clean up email dedup marker when user has no email
When user.google_user_email is falsy in maybeSendDuplicateCardCanceledEmail, the transactional_email_log marker was left in the DB permanently. This suppressed future email sends even if the user later acquired an email. Now the marker is deleted before returning, consistent with the error-path cleanup logic.
1 parent a9590f5 commit 24d6ed3

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

apps/web/src/lib/kilo-pass/card-fingerprint-gate.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,17 @@ export async function maybeSendDuplicateCardCanceledEmail(params: {
270270
where: eq(kilocode_users.id, kiloUserId),
271271
});
272272

273-
if (!user?.google_user_email) return;
273+
if (!user?.google_user_email) {
274+
await db
275+
.delete(transactional_email_log)
276+
.where(
277+
and(
278+
eq(transactional_email_log.email_type, KILO_PASS_DUPLICATE_CARD_EMAIL_TYPE),
279+
eq(transactional_email_log.idempotency_key, stripeInvoiceId)
280+
)
281+
);
282+
return;
283+
}
274284

275285
const sendResult = await sendKiloPassDuplicateCardCanceledEmail(user.google_user_email, {});
276286

0 commit comments

Comments
 (0)