Commit 970e1fe7 authored by Thomas Löffler's avatar Thomas Löffler

Merge branch 'develop' into 'main'

Release 16-03-2021

See merge request !651
parents 4e315042 309bfaf7
Pipeline #10518 passed with stages
in 9 minutes and 35 seconds
This diff is collapsed.
......@@ -12,6 +12,7 @@ namespace T3o\Ter\Api;
*/
use ApacheSolrForTypo3\Solr\IndexQueue\Queue;
use Symfony\Component\Mime\Address;
use T3o\Ter\Exception\FailedDependencyException;
use T3o\Ter\Exception\InternalServerErrorException;
use T3o\Ter\Exception\InvalidExtensionVersionFormatException;
......@@ -24,6 +25,8 @@ use T3o\TerFe2\Utility\CategoryUtility;
use T3o\TerFe2\Utility\VersionUtility;
use TYPO3\CMS\Core\Cache\CacheManager;
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Mail\FluidEmail;
use TYPO3\CMS\Core\Mail\Mailer;
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\VersionNumberUtility;
......@@ -708,20 +711,25 @@ class ExtensionVersion
if (!empty($notifications)) {
foreach ($notifications as $notification) {
$mail = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Mail\MailMessage::class);
$mail->setTo($notification['email'], $notification['name']);
$mail->setSubject('Release of extension "' . (string)$this->extensionKey . '", version ' . $extensionData['version_string']);
$standalone = GeneralUtility::makeInstance(\TYPO3\CMS\Fluid\View\StandaloneView::class);
$standalone->setTemplatePathAndFilename('EXT:ter_fe2/Resources/Private/Templates/Mail/NewVersionNotify.html');
$standalone->assignMultiple(
[
$email = $notification['email'] ?? '';
$username = $notification['username'] ?? '';
if ($email === '' || !GeneralUtility::validEmail($email)) {
continue;
}
$fluidEmail = GeneralUtility::makeInstance(FluidEmail::class);
$fluidEmail
->to(new Address($email, $username))
->format(FluidEmail::FORMAT_PLAIN)
->subject(sprintf('Release of extension "%s", version %s', $this->extensionKey, $extensionData['version_string'] ?? ''))
->setTemplate('NewVersionNotify')
->assignMultiple([
'notify' => $notification,
'extData' => $extensionData
]
);
$mail->text($standalone->render());
]);
$mail->send();
GeneralUtility::makeInstance(Mailer::class)->send($fluidEmail);
}
}
}
......
......@@ -180,6 +180,10 @@ class Relation extends \TYPO3\CMS\Extbase\DomainObject\AbstractValueObject
$version[] = VersionUtility::convertIntegerToVersionNumber($this->maximumVersion);
}
if (count($version) === 1 && $this->getRelationType() !== 'php') {
return '>= ' . $version[0];
}
return !empty($version) ? implode(' - ', $version) : '';
}
......
......@@ -3,7 +3,7 @@ Dear {notify.name},
there was just a new release of the extension "{notify.ext_key}" with version {extData.version_string}.
Upload comment:
{extData.upload_comment -> f:format.nl2br()}
{extData.upload_comment}
URL: https://extensions.typo3.org/extension/{notify.ext_key}
Download as ZIP: https://extensions.typo3.org/extension/download/{notify.ext_key}/{extData.version_string}/
......
<?php
namespace T3o\TerFe2\Tests\Unit\Domain\Model;
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
use Nimut\TestingFramework\TestCase\UnitTestCase;
use T3o\TerFe2\Domain\Model\Relation;
class RelationTest extends UnitTestCase
{
/**
* @test
* @dataProvider getVersionStringDataProvider
*/
public function getVersionStringTest(Relation $relation, string $expected): void
{
self::assertEquals(
$expected,
$relation->getVersionString()
);
}
public function getVersionStringDataProvider(): array
{
$relationWithMinMax = new Relation();
$relationWithMinMax->setMinimumVersion(9005000);
$relationWithMinMax->setMaximumVersion(10004099);
$relationWithOnlyMin = new Relation();
$relationWithOnlyMin->setMinimumVersion(9005000);
$relationSystem = new Relation();
$relationSystem->setRelationType('php');
$relationSystem->setMinimumVersion(5005000);
return [
'relation with min and max' => [
'relation' => $relationWithMinMax,
'expected' => '9.5.0 - 10.4.99'
],
'relation with only min' => [
'relation' => $relationWithOnlyMin,
'expected' => '>= 9.5.0'
],
'relation with only min, type system' => [
'relation' => $relationSystem,
'expected' => '5.5.0'
]
];
}
}
......@@ -558,10 +558,10 @@ class VersionService extends AbstractService
foreach ($notificationRecipients as $recipient) {
$this->mailService->sendMailToUser(
['email' => $recipient['email'], 'username' => $recipient['name']],
'Release of extension "' . $this->key . '", version ' . $this->version,
sprintf('Release of extension "%s", version %s', $this->key, $this->version),
['notify' => $recipient, 'extData' => $versionFields],
'NewVersionNotify',
FluidEmail::FORMAT_HTML
FluidEmail::FORMAT_PLAIN
);
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment