fix: Persistence of subscription state for existing contacts

This commit is contained in:
Dries Augustyns
2025-12-18 19:43:59 +01:00
parent 23b4ec992d
commit 007a908e83
5 changed files with 589 additions and 6 deletions
+4 -2
View File
@@ -128,8 +128,10 @@ export function createImportWorker() {
const existingContact = await ContactService.findByEmail(projectId, email);
const isUpdate = !!existingContact;
// Upsert contact with subscribed value from CSV if provided, otherwise default to true
await ContactService.upsert(projectId, email, data, subscribed ?? true);
// Upsert contact with subscribed value from CSV if provided
// For new contacts, ContactService.upsert defaults to true
// For existing contacts, only update if explicitly provided in CSV
await ContactService.upsert(projectId, email, data, subscribed);
result.successCount++;
if (isUpdate) {