File tree Expand file tree Collapse file tree 3 files changed +17
-17
lines changed Expand file tree Collapse file tree 3 files changed +17
-17
lines changed Original file line number Diff line number Diff 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 ;
Original file line number Diff line number Diff 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}
Original file line number Diff line number Diff 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
10117.3
1112---
You can’t perform that action at this time.
0 commit comments