-
Notifications
You must be signed in to change notification settings - Fork 29
Fix: mailing #382
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Fix: mailing #382
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -8,6 +8,7 @@ | |||||||||||
| use PhpList\Core\Domain\Common\Model\Interfaces\OwnableInterface; | ||||||||||||
| use PhpList\Core\Domain\Identity\Model\Administrator; | ||||||||||||
| use PhpList\Core\Domain\Identity\Model\PrivilegeFlag; | ||||||||||||
| use PhpList\Core\Domain\Messaging\Model\ListMessage; | ||||||||||||
| use PhpList\Core\Domain\Messaging\Model\Message; | ||||||||||||
| use PhpList\Core\Domain\Subscription\Model\Subscriber; | ||||||||||||
| use PhpList\Core\Domain\Subscription\Model\SubscriberList; | ||||||||||||
|
|
@@ -70,9 +71,7 @@ private function resolveRelatedEntity(DomainModel $resource, string $relatedClas | |||||||||||
| } | ||||||||||||
|
|
||||||||||||
| if ($resource instanceof Message && $relatedClass === SubscriberList::class) { | ||||||||||||
| // todo: check which one is correct | ||||||||||||
| // return $resource->getListMessages()->map(fn(ListMessage $lm) => $lm->getList())->toArray(); | ||||||||||||
| return $resource->getListMessages()->map(fn($lm) => $lm->getSubscriberList())->toArray(); | ||||||||||||
| return $resource->getListMessages()->map(fn(ListMessage $lm) => $lm->getList())->toArray(); | ||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Filter nullable list relations before ownership checks. At Line 74, Suggested patch- return $resource->getListMessages()->map(fn(ListMessage $lm) => $lm->getList())->toArray();
+ return $resource->getListMessages()
+ ->map(fn (ListMessage $lm) => $lm->getList())
+ ->filter(fn (?SubscriberList $list) => $list !== null)
+ ->toArray();📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||
| } | ||||||||||||
|
|
||||||||||||
| return []; | ||||||||||||
|
|
||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -199,12 +199,13 @@ private function handleEmailSending( | |||||||||||||||||||
| UserMessage $userMessage, | ||||||||||||||||||||
| MessagePrecacheDto $precachedContent, | ||||||||||||||||||||
| ): void { | ||||||||||||||||||||
| // todo: check at which point link tracking should be applied (maybe after constructing ful text?) | ||||||||||||||||||||
| // todo: check at which point link tracking should be applied (maybe after constructing full text?) | ||||||||||||||||||||
| $processed = $this->messagePreparator->processMessageLinks( | ||||||||||||||||||||
| campaignId: $campaign->getId(), | ||||||||||||||||||||
| cachedMessageDto: $precachedContent, | ||||||||||||||||||||
| subscriber: $subscriber | ||||||||||||||||||||
| ); | ||||||||||||||||||||
| $this->entityManager->flush(); | ||||||||||||||||||||
|
|
||||||||||||||||||||
| try { | ||||||||||||||||||||
|
Comment on lines
+208
to
210
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Put the new flush inside the At Line 208, Suggested patch- $this->entityManager->flush();
-
- try {
+ try {
+ $this->entityManager->flush();
$result = $this->campaignEmailBuilder->buildCampaignEmail(
messageId: $campaign->getId(),
data: $processed,📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||
| $result = $this->campaignEmailBuilder->buildCampaignEmail( | ||||||||||||||||||||
|
|
||||||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.