Skip to content

Commit d46df40

Browse files
Minor tweaks
1 parent ba5f368 commit d46df40

File tree

3 files changed

+17
-17
lines changed

3 files changed

+17
-17
lines changed

src/Symfony/Component/Mailer/Bridge/Sendgrid/Header/SuppressionGroupHeader.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@ public function __construct(
2525
private int $groupId,
2626
private array $groupsToDisplay = [],
2727
) {
28-
$this->groupsToDisplay = array_values(array_map('intval', $groupsToDisplay));
29-
3028
parent::__construct('X-Sendgrid-SuppressionGroup', json_encode([
3129
'group_id' => $groupId,
3230
'groups_to_display' => $this->groupsToDisplay,
@@ -38,6 +36,9 @@ public function getGroupId(): int
3836
return $this->groupId;
3937
}
4038

39+
/**
40+
* @return int[]
41+
*/
4142
public function getGroupsToDisplay(): array
4243
{
4344
return $this->groupsToDisplay;

src/Symfony/Component/Mailer/Bridge/Sendgrid/Transport/SendgridSmtpTransport.php

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -50,29 +50,27 @@ private function addSendgridHeaders(Message $message): void
5050
return;
5151
}
5252

53-
$suppressionHeader = null;
54-
5553
foreach ($headers->all() as $header) {
5654
if ($header instanceof SuppressionGroupHeader) {
57-
$suppressionHeader = $header;
5855
break;
5956
}
6057
}
6158

62-
if ($suppressionHeader) {
63-
$payload = [
64-
'asm' => [
65-
'group_id' => $suppressionHeader->getGroupId(),
66-
],
67-
];
59+
if (!$header instanceof SuppressionGroupHeader) {
60+
return;
61+
}
6862

69-
$groupsToDisplay = $suppressionHeader->getGroupsToDisplay();
70-
if ($groupsToDisplay) {
71-
$payload['asm']['groups_to_display'] = $groupsToDisplay;
72-
}
63+
$payload = [
64+
'asm' => [
65+
'group_id' => $header->getGroupId(),
66+
],
67+
];
7368

74-
$headers->addTextHeader('X-SMTPAPI', json_encode($payload, \JSON_UNESCAPED_SLASHES));
75-
$headers->remove('X-Sendgrid-SuppressionGroup');
69+
if ($groupsToDisplay = $header->getGroupsToDisplay()) {
70+
$payload['asm']['groups_to_display'] = $groupsToDisplay;
7671
}
72+
73+
$headers->addTextHeader('X-SMTPAPI', json_encode($payload, \JSON_UNESCAPED_SLASHES));
74+
$headers->remove('X-Sendgrid-SuppressionGroup');
7775
}
7876
}

src/Symfony/Component/Routing/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ CHANGELOG
66

77
* Allow query-specific parameters in `UrlGenerator` using `_query`
88
* Add support of multiple env names in the `Symfony\Component\Routing\Attribute\Route` attribute
9+
* Add argument `$parameter` to `RequestContext`'s constructor
910

1011
7.3
1112
---

0 commit comments

Comments
 (0)