8000 Merge branch '5.1' · symfony/symfony@2ac2aaa · GitHub
[go: up one dir, main page]

Skip to content

Commit 2ac2aaa

Browse files
committed
Merge branch '5.1'
* 5.1: Fix CS [Mailer] Fixed mandrill api header structure [Mailer] Support reply-to in SesApiAsyncAwsTransport [HttpClient][ResponseTrait] Fix typo Fix CS [Notifier] Fixed base_uri while call auth/time API [Mailer] Reorder headers used to determine Sender [Validator] Add Lithuanian translation for ISIN constraint
2 parents a80dbc5 + eec66a2 commit 2ac2aaa

File tree

10 files changed

+41
-14
lines changed

10 files changed

+41
-14
lines changed

src/Symfony/Component/HttpClient/Response/TransportResponseTrait.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ public static function stream(iterable $responses, float $timeout = null): \Gene
147147
}
148148

149149
$lastActivity = microtime(true);
150-
$enlapsedTimeout = 0;
150+
$elapsedTimeout = 0;
151151

152152
while (true) {
153153
$hasActivity = false;
@@ -169,15 +169,15 @@ public static function stream(iterable $responses, float $timeout = null): \Gene
169169
} elseif (!isset($multi->openHandles[$j])) {
170170
unset($responses[$j]);
171171
continue;
172-
} elseif ($enlapsedTimeout >= $timeoutMax) {
172+
} elseif ($elapsedTimeout >= $timeoutMax) {
173173
$multi->handlesActivity[$j] = [new ErrorChunk($response->offset, sprintf('Idle timeout reached for "%s".', $response->getInfo('url')))];
174174
} else {
175175
continue;
176176
}
177177

178178
while ($multi->handlesActivity[$j] ?? false) {
179179
$hasActivity = true;
180-
$enlapsedTimeout = 0;
180+
$elapsedTimeout = 0;
181181

182182
if (\is_string($chunk = array_shift($multi->handlesActivity[$j]))) {
183183
if (null !== $response->inflate && false === $chunk = @inflate_add($response->inflate, $chunk)) {
@@ -211,7 +211,7 @@ public static function stream(iterable $responses, float $timeout = null): \Gene
211211
}
212212
} elseif ($chunk instanceof ErrorChunk) {
213213
unset($responses[$j]);
214-
$enlapsedTimeout = $timeoutMax;
214+
$elapsedTimeout = $timeoutMax;
215215
} elseif ($chunk instanceof FirstChunk) {
216216
if ($response->logger) {
217217
$info = $response->getInfo();
@@ -279,11 +279,11 @@ public static function stream(iterable $responses, float $timeout = null): \Gene
279279
continue;
280280
}
281281

282-
if (-1 === self::select($multi, min($timeoutMin, $timeoutMax - $enlapsedTimeout))) {
282+
if (-1 === self::select($multi, min($timeoutMin, $timeoutMax - $elapsedTimeout))) {
283283
usleep(min(500, 1E6 * $timeoutMin));
284284
}
285285

286-
$enlapsedTimeout = microtime(true) - $lastActivity;
286+
$elapsedTimeout = microtime(true) - $lastActivity;
287287
}
288288
}
289289
}

src/Symfony/Component/Mailer/Bridge/Amazon/Tests/Transport/SesApiAsyncAwsTransportTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ public function testSend()
6868
$this->assertSame('Fabien <fabpot@symfony.com>', $content['FromEmailAddress']);
6969
$this->assertSame('Hello There!', $content['Content']['Simple']['Body']['Text']['Data']);
7070
$this->assertSame('<b>Hello There!</b>', $content['Content']['Simple']['Body']['Html']['Data']);
71+
$this->assertSame(['replyto-1@example.com', 'replyto-2@example.com'], $content['ReplyToAddresses']);
7172

7273
$json = '{"MessageId": "foobar"}';
7374

@@ -83,7 +84,8 @@ public function testSend()
8384
->to(new Address('saif.gmati@symfony.com', 'Saif Eddin'))
8485
->from(new Address('fabpot@symfony.com', 'Fabien'))
8586
->text('Hello There!')
86-
->html('<b>Hello There!</b>');
87+
->html('<b>Hello There!</b>')
88+
->replyTo(new Address('replyto-1@example.com'), new Address('replyto-2@example.com'));
8789

8890
$message = $transport->send($mail);
8991

src/Symfony/Component/Mailer/Bridge/Amazon/Transport/SesApiAsyncAwsTransport.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,9 @@ protected function getRequest(SentMessage $message): SendEmailRequest
8686
'Charset' => $email->getHtmlCharset(),
8787
]);
8888
}
89+
if ($emails = $email->getReplyTo()) {
90+
$request['ReplyToAddresses'] = $this->stringifyAddresses($emails);
91+
}
8992

9093
return new SendEmailRequest($request);
9194
}

src/Symfony/Component/Mailer/Bridge/Amazon/Transport/SesHttpAsyncAwsTransport.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ protected function doSend(SentMessage $message): void
6868
protected function getRequest(SentMessage $message): SendEmailRequest
6969
{
7070
return new SendEmailRequest([
71-
'Destination' => $destination = new Destination([
71+
'Destination' => new Destination([
7272
'ToAddresses' => $this->stringifyAddresses($message->getEnvelope()->getRecipients()),
7373
]),
7474
'Content' => [

src/Symfony/Component/Mailer/Bridge/Mailchimp/Tests/Transport/MandrillApiTransportTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public function testCustomHeader()
6565
$this->assertArrayHasKey('message', $payload);
6666
$this->assertArrayHasKey('headers', $payload['message']);
6767
$this->assertCount(1, $payload['message']['headers']);
68-
$this->assertEquals('foo: bar', $payload['message']['headers'][0]);
68+
$this->assertEquals('bar', $payload['message']['headers']['foo']);
6969
}
7070

7171
public function testSend()
10000

src/Symfony/Component/Mailer/Bridge/Mailchimp/Transport/MandrillApiTransport.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ private function getPayload(Email $email, Envelope $envelope): array
125125
continue;
126126
}
127127

128-
$payload['message']['headers'][] = $name.': '.$header->getBodyAsString();
128+
$payload['message']['headers'][$name] = $header->getBodyAsString();
129129
}
130130

131131
return $payload;

src/Symfony/Component/Mailer/DelayedEnvelope.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,15 +83,15 @@ private static function getRecipientsFromHeaders(Headers $headers): array
8383

8484
private static function getSenderFromHeaders(Headers $headers): Address
8585
{
86-
if ($return = $headers->get('Return-Path')) {
87-
return $return->getAddress();
88-
}
8986
if ($sender = $headers->get('Sender')) {
9087
return $sender->getAddress();
9188
}
9289
if ($from = $headers->get('From')) {
9390
return $from->getAddresses()[0];
9491
}
92+
if ($return = $headers->get('Return-Path')) {
93+
return $return->getAddress();
94+
}
9595

9696
throw new LogicException('Unable to determine the sender of the message.');
9797
}

src/Symfony/Component/Mailer/Tests/EnvelopeTest.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,24 @@ public function testSenderFromHeadersWithoutFrom()
9898
$this->assertEquals($from, $e->getSender());
9999
}
100100

101+
public function testSenderFromHeadersWithMulitpleHeaders()
102+
{
103+
$headers = new Headers();
104+
$headers->addMailboxListHeader('From', [$from = new Address('from@symfony.com', 'from'), 'some@symfony.com']);
105+
$headers->addPathHeader('Return-Path', $return = new Address('return@symfony.com', 'return'));
106+
$headers->addMailboxHeader('Sender', $sender = new Address('sender@symfony.com', 'sender'));
107+
$headers->addMailboxListHeader('To', ['to@symfony.com']);
108+
$e = Envelope::create(new Message($headers));
109+
$this->assertEquals($sender, $e->getSender());
110+
111+
$headers = new Headers();
112+
$headers->addMailboxListHeader('From', [$from = new Address('from@symfony.com', 'from'), 'some@symfony.com']);
113+
$headers->addPathHeader('Return-Path', $return = new Address('return@symfony.com', 'return'));
114+
$headers->addMailboxListHeader('To', ['to@symfony.com']);
115+
$e = Envelope::create(new Message($headers));
116+
$this->assertEquals($from, $e->getSender());
117+
}
118+
101119
public function testRecipientsFromHeaders()
102120
{
103121
$headers = new Headers();

src/Symfony/Component/Notifier/Bridge/OvhCloud/OvhCloudTransport.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ protected function doSend(MessageInterface $message): SentMessage
105105
*/
106106
private function calculateTimeDelta(): int
107107
{
108-
$endpoint = sprintf('%s/auth/time', $this->getEndpoint());
108+
$endpoint = sprintf('https://%s/1.0/auth/time', $this->getEndpoint());
109109
$response = $this->client->request('GET', $endpoint);
110110

111111
return $response->getContent() - time();

src/Symfony/Component/Validator/Resources/translations/validators.lt.xlf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,10 @@
382382
<source>Each element of this collection should satisfy its own set of constraints.</source>
383383
<target>Kiekvienas šio sąrašo elementas turi atitikti savo nurodymų rinkinį.</target>
384384
</trans-unit>
385+
<trans-unit id="99">
386+
<source>This value is not a valid International Securities Identification Number (ISIN).</source>
387+
<target>Ši reišmė neatitinka tarptautinio vertybinių popierių identifikavimo numerio formato (ISIN).</target>
388+
</trans-unit>
385389
</body>
386390
</file>
387391
</xliff>

0 commit comments

Comments
 (0)
0