fix: clear Mailwizz checkboxlist tag when deleting subscriber
Encode empty checkboxlist arrays as an empty scalar so multipart requests include the field. On delete, PUT only coupon and tag fields to Mailwizz after merging the tag CSV from getSubscriber. Made-with: Cursor
This commit is contained in:
@@ -104,8 +104,8 @@ final class CleanupSubscriberIntegrationsService
|
||||
}
|
||||
|
||||
$subscriberUid = $search['subscriber_uid'];
|
||||
$phoneEnabled = $page->isPhoneFieldEnabledForSubscribers();
|
||||
$data = MailwizzSubscriberFormPayload::baseFields($subscriber, $config, $phoneEnabled);
|
||||
/** @var array<string, mixed> $data */
|
||||
$data = [];
|
||||
|
||||
$couponField = $config->field_coupon_code;
|
||||
if (is_string($couponField) && $couponField !== '') {
|
||||
@@ -123,6 +123,10 @@ final class CleanupSubscriberIntegrationsService
|
||||
$data[$tagField] = MailwizzCheckboxlistTags::removeValueFromCsv($existingCsv, $tagValue);
|
||||
}
|
||||
|
||||
if ($data === []) {
|
||||
return;
|
||||
}
|
||||
|
||||
$service->updateSubscriber($listUid, $subscriberUid, $data);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user