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
This commit is contained in:
commit
2ac2aaab23
@ -147,7 +147,7 @@ trait TransportResponseTrait
|
||||
}
|
||||
|
||||
$lastActivity = microtime(true);
|
||||
$enlapsedTimeout = 0;
|
||||
$elapsedTimeout = 0;
|
||||
|
||||
while (true) {
|
||||
$hasActivity = false;
|
||||
@ -169,7 +169,7 @@ trait TransportResponseTrait
|
||||
} elseif (!isset($multi->openHandles[$j])) {
|
||||
unset($responses[$j]);
|
||||
continue;
|
||||
} elseif ($enlapsedTimeout >= $timeoutMax) {
|
||||
} elseif ($elapsedTimeout >= $timeoutMax) {
|
||||
$multi->handlesActivity[$j] = [new ErrorChunk($response->offset, sprintf('Idle timeout reached for "%s".', $response->getInfo('url')))];
|
||||
} else {
|
||||
continue;
|
||||
@ -177,7 +177,7 @@ trait TransportResponseTrait
|
||||
|
||||
while ($multi->handlesActivity[$j] ?? false) {
|
||||
$hasActivity = true;
|
||||
$enlapsedTimeout = 0;
|
||||
$elapsedTimeout = 0;
|
||||
|
||||
if (\is_string($chunk = array_shift($multi->handlesActivity[$j]))) {
|
||||
if (null !== $response->inflate && false === $chunk = @inflate_add($response->inflate, $chunk)) {
|
||||
@ -211,7 +211,7 @@ trait TransportResponseTrait
|
||||
}
|
||||
} elseif ($chunk instanceof ErrorChunk) {
|
||||
unset($responses[$j]);
|
||||
$enlapsedTimeout = $timeoutMax;
|
||||
$elapsedTimeout = $timeoutMax;
|
||||
} elseif ($chunk instanceof FirstChunk) {
|
||||
if ($response->logger) {
|
||||
$info = $response->getInfo();
|
||||
@ -279,11 +279,11 @@ trait TransportResponseTrait
|
||||
continue;
|
||||
}
|
||||
|
||||
if (-1 === self::select($multi, min($timeoutMin, $timeoutMax - $enlapsedTimeout))) {
|
||||
if (-1 === self::select($multi, min($timeoutMin, $timeoutMax - $elapsedTimeout))) {
|
||||
usleep(min(500, 1E6 * $timeoutMin));
|
||||
}
|
||||
|
||||
$enlapsedTimeout = microtime(true) - $lastActivity;
|
||||
$elapsedTimeout = microtime(true) - $lastActivity;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -68,6 +68,7 @@ class SesApiAsyncAwsTransportTest extends TestCase
|
||||
$this->assertSame('Fabien <fabpot@symfony.com>', $content['FromEmailAddress']);
|
||||
$this->assertSame('Hello There!', $content['Content']['Simple']['Body']['Text']['Data']);
|
||||
$this->assertSame('<b>Hello There!</b>', $content['Content']['Simple']['Body']['Html']['Data']);
|
||||
$this->assertSame(['replyto-1@example.com', 'replyto-2@example.com'], $content['ReplyToAddresses']);
|
||||
|
||||
$json = '{"MessageId": "foobar"}';
|
||||
|
||||
@ -83,7 +84,8 @@ class SesApiAsyncAwsTransportTest extends TestCase
|
||||
->to(new Address('saif.gmati@symfony.com', 'Saif Eddin'))
|
||||
->from(new Address('fabpot@symfony.com', 'Fabien'))
|
||||
->text('Hello There!')
|
||||
->html('<b>Hello There!</b>');
|
||||
->html('<b>Hello There!</b>')
|
||||
->replyTo(new Address('replyto-1@example.com'), new Address('replyto-2@example.com'));
|
||||
|
||||
$message = $transport->send($mail);
|
||||
|
||||
|
@ -86,6 +86,9 @@ class SesApiAsyncAwsTransport extends SesHttpAsyncAwsTransport
|
||||
'Charset' => $email->getHtmlCharset(),
|
||||
]);
|
||||
}
|
||||
if ($emails = $email->getReplyTo()) {
|
||||
$request['ReplyToAddresses'] = $this->stringifyAddresses($emails);
|
||||
}
|
||||
|
||||
return new SendEmailRequest($request);
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ class SesHttpAsyncAwsTransport extends AbstractTransport
|
||||
protected function getRequest(SentMessage $message): SendEmailRequest
|
||||
{
|
||||
return new SendEmailRequest([
|
||||
'Destination' => $destination = new Destination([
|
||||
'Destination' => new Destination([
|
||||
'ToAddresses' => $this->stringifyAddresses($message->getEnvelope()->getRecipients()),
|
||||
]),
|
||||
'Content' => [
|
||||
|
@ -65,7 +65,7 @@ class MandrillApiTransportTest extends TestCase
|
||||
$this->assertArrayHasKey('message', $payload);
|
||||
$this->assertArrayHasKey('headers', $payload['message']);
|
||||
$this->assertCount(1, $payload['message']['headers']);
|
||||
$this->assertEquals('foo: bar', $payload['message']['headers'][0]);
|
||||
$this->assertEquals('bar', $payload['message']['headers']['foo']);
|
||||
}
|
||||
|
||||
public function testSend()
|
||||
|
@ -125,7 +125,7 @@ class MandrillApiTransport extends AbstractApiTransport
|
||||
continue;
|
||||
}
|
||||
|
||||
$payload['message']['headers'][] = $name.': '.$header->getBodyAsString();
|
||||
$payload['message']['headers'][$name] = $header->getBodyAsString();
|
||||
}
|
||||
|
||||
return $payload;
|
||||
|
@ -83,15 +83,15 @@ final class DelayedEnvelope extends Envelope
|
||||
|
||||
private static function getSenderFromHeaders(Headers $headers): Address
|
||||
{
|
||||
if ($return = $headers->get('Return-Path')) {
|
||||
return $return->getAddress();
|
||||
}
|
||||
if ($sender = $headers->get('Sender')) {
|
||||
return $sender->getAddress();
|
||||
}
|
||||
if ($from = $headers->get('From')) {
|
||||
return $from->getAddresses()[0];
|
||||
}
|
||||
if ($return = $headers->get('Return-Path')) {
|
||||
return $return->getAddress();
|
||||
}
|
||||
|
||||
throw new LogicException('Unable to determine the sender of the message.');
|
||||
}
|
||||
|
@ -98,6 +98,24 @@ class EnvelopeTest extends TestCase
|
||||
$this->assertEquals($from, $e->getSender());
|
||||
}
|
||||
|
||||
public function testSenderFromHeadersWithMulitpleHeaders()
|
||||
{
|
||||
$headers = new Headers();
|
||||
$headers->addMailboxListHeader('From', [$from = new Address('from@symfony.com', 'from'), 'some@symfony.com']);
|
||||
$headers->addPathHeader('Return-Path', $return = new Address('return@symfony.com', 'return'));
|
||||
$headers->addMailboxHeader('Sender', $sender = new Address('sender@symfony.com', 'sender'));
|
||||
$headers->addMailboxListHeader('To', ['to@symfony.com']);
|
||||
$e = Envelope::create(new Message($headers));
|
||||
$this->assertEquals($sender, $e->getSender());
|
||||
|
||||
$headers = new Headers();
|
||||
$headers->addMailboxListHeader('From', [$from = new Address('from@symfony.com', 'from'), 'some@symfony.com']);
|
||||
$headers->addPathHeader('Return-Path', $return = new Address('return@symfony.com', 'return'));
|
||||
$headers->addMailboxListHeader('To', ['to@symfony.com']);
|
||||
$e = Envelope::create(new Message($headers));
|
||||
$this->assertEquals($from, $e->getSender());
|
||||
}
|
||||
|
||||
public function testRecipientsFromHeaders()
|
||||
{
|
||||
$headers = new Headers();
|
||||
|
@ -105,7 +105,7 @@ final class OvhCloudTransport extends AbstractTransport
|
||||
*/
|
||||
private function calculateTimeDelta(): int
|
||||
{
|
||||
$endpoint = sprintf('%s/auth/time', $this->getEndpoint());
|
||||
$endpoint = sprintf('https://%s/1.0/auth/time', $this->getEndpoint());
|
||||
$response = $this->client->request('GET', $endpoint);
|
||||
|
||||
return $response->getContent() - time();
|
||||
|
@ -382,6 +382,10 @@
|
||||
<source>Each element of this collection should satisfy its own set of constraints.</source>
|
||||
<target>Kiekvienas šio sąrašo elementas turi atitikti savo nurodymų rinkinį.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="99">
|
||||
<source>This value is not a valid International Securities Identification Number (ISIN).</source>
|
||||
<target>Ši reišmė neatitinka tarptautinio vertybinių popierių identifikavimo numerio formato (ISIN).</target>
|
||||
</trans-unit>
|
||||
</body>
|
||||
</file>
|
||||
</xliff>
|
||||
|
Reference in New Issue
Block a user