-
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
a6502a4
0145d30
f0abd5e
4be13d1
d26f2c5
79edd73
9fa4364
56ab93f
3861db0
47ec84c
1db5a45
7285513
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 |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| <?php | ||
|
|
||
| declare(strict_types=1); | ||
|
|
||
| namespace PhpList\Core\Domain\Messaging\Message\CampaignProcessor; | ||
|
|
||
| class TestCampaignProcessorMessage implements CampaignProcessorMessageInterface | ||
| { | ||
| private int $messageId; | ||
| private array $listIds; | ||
| private array $subscriberEmails; | ||
|
|
||
| public function __construct(int $messageId, ?array $listIds = [], ?array $subscriberEmails = []) | ||
| { | ||
| $this->messageId = $messageId; | ||
| $this->listIds = $listIds ?? []; | ||
| $this->subscriberEmails = $subscriberEmails ?? []; | ||
| } | ||
|
|
||
| public function getMessageId(): int | ||
| { | ||
| return $this->messageId; | ||
| } | ||
|
|
||
| public function getListIds(): array | ||
| { | ||
| return $this->listIds; | ||
| } | ||
|
|
||
| public function getSubscriberEmails(): array | ||
| { | ||
| return $this->subscriberEmails; | ||
| } | ||
| } |
Uh oh!
There was an error while loading. Please reload this page.