Skip to content

Commit 428f65f

Browse files
TatevikGrtatevikg1
andauthored
release: dev → main (improve message workflow, draft copying, permission handling, bounce regex management) (#382)
* Fix: mailing * Add: copy as draft message functionality * Fix: remove $formatOptions from MessageFormatDto * TestCampaignProcessorMessageHandler * Fixes to send test email * Fix: _instanceof resolver tags and autowiring * Add: ttl for message precache * MessageContentBuilder html2Text * FooterContentIsResolvedForNestedPlaceholders * Determine htmlFormatted from content * Validate campaign before setting status to submitted * Filter campaigns by subject too Throw ValidatorException in MessageMetadata * Add index.php * Fix: template content handling * Add: template image provider * Add: default templates * Bounces * Bounces: filter be identified/unidentified * Fix: not nullable fields * BounceAction enum * Bounce regex update --------- Co-authored-by: Tatevik <tatevikg1@gmail.com>
1 parent f8de2e3 commit 428f65f

91 files changed

Lines changed: 2200 additions & 280 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,3 +222,9 @@ command to extract translation strings
222222
```bash
223223
php bin/console translation:extract --force en --format=xlf
224224
```
225+
226+
```bash
227+
vendor/bin/phpstan analyse -c phpstan.neon;
228+
vendor/bin/phpmd src/ text config/PHPMD/rules.xml;
229+
vendor/bin/phpcs --standard=config/PhpCodeSniffer/ --ignore=*/Migrations/* bin/ src/ tests/ public/;
230+
```

config/services/mappers.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,7 @@ services:
1111
PhpList\Core\Domain\Subscription\Service\CsvToDtoImporter:
1212
autowire: true
1313
autoconfigure: true
14+
15+
PhpList\Core\Domain\Messaging\Service\Mapper\DefaultTemplateMapper:
16+
autowire: true
17+
autoconfigure: true

config/services/messenger.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ services:
1111
resource: '../../src/Domain/Subscription/MessageHandler'
1212
tags: [ 'messenger.message_handler' ]
1313

14-
PhpList\Core\Domain\Messaging\MessageHandler\CampaignProcessorMessageHandler:
14+
PhpList\Core\Domain\Messaging\MessageHandler\CampaignProcessor\CampaignProcessorMessageHandler:
15+
autowire: true
16+
autoconfigure: true
17+
18+
PhpList\Core\Domain\Messaging\MessageHandler\CampaignProcessor\TestCampaignProcessorMessageHandler:
1519
autowire: true
1620
autoconfigure: true

config/services/resolvers.yml

Lines changed: 14 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,16 @@
11
services:
2+
_defaults:
3+
autowire: true
4+
autoconfigure: true
5+
6+
_instanceof:
7+
PhpList\Core\Domain\Configuration\Service\Placeholder\PlaceholderValueResolverInterface:
8+
tags: ['phplist.placeholder_resolver']
9+
PhpList\Core\Domain\Configuration\Service\Placeholder\PatternValueResolverInterface:
10+
tags: ['phplist.pattern_resolver']
11+
PhpList\Core\Domain\Configuration\Service\Placeholder\SupportingPlaceholderResolverInterface:
12+
tags: ['phplist.supporting_placeholder_resolver']
13+
214
PhpList\Core\Domain\Subscription\Service\Resolver\AttributeValueResolver:
315
arguments:
416
$providers:
@@ -14,26 +26,5 @@ services:
1426
arguments:
1527
- !tagged_iterator { tag: 'phplist.bounce_action_handler' }
1628

17-
PhpList\Core\Domain\Configuration\Service\Placeholder\UnsubscribeUrlValueResolver:
18-
autowire: true
19-
autoconfigure: true
20-
21-
PhpList\Core\Domain\Configuration\Service\Placeholder\ConfirmationUrlValueResolver:
22-
autowire: true
23-
autoconfigure: true
24-
25-
PhpList\Core\Domain\Configuration\Service\Placeholder\PreferencesUrlValueResolver:
26-
autowire: true
27-
autoconfigure: true
28-
29-
PhpList\Core\Domain\Configuration\Service\Placeholder\SubscribeUrlValueResolver:
30-
autowire: true
31-
autoconfigure: true
32-
33-
_instanceof:
34-
PhpList\Core\Domain\Configuration\Service\Placeholder\PlaceholderValueResolverInterface:
35-
tags: ['phplist.placeholder_resolver']
36-
PhpList\Core\Domain\Configuration\Service\Placeholder\PatternValueResolverInterface:
37-
tags: [ 'phplist.pattern_resolver' ]
38-
PhpList\Core\Domain\Configuration\Service\Placeholder\SupportingPlaceholderResolverInterface:
39-
tags: [ 'phplist.supporting_placeholder_resolver' ]
29+
PhpList\Core\Domain\Configuration\Service\Placeholder\:
30+
resource: '../../src/Domain/Configuration/Service/Placeholder/*'

public/.htaccess

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# mod_rewrite). Additionally, this reduces the matching process for the
44
# start page (path "/") because otherwise Apache will apply the rewriting rules
55
# to each configured DirectoryIndex file (e.g. index.php, index.html, index.pl).
6-
DirectoryIndex app.php
6+
DirectoryIndex index.php
77

88
# By default, Apache does not evaluate symbolic links if you did not enable this
99
# feature in your server configuration. Uncomment the following line if you
@@ -46,23 +46,23 @@ DirectoryIndex app.php
4646
# - use Apache >= 2.3.9 and replace all L flags by END flags and remove the
4747
# following RewriteCond (best solution)
4848
RewriteCond %{ENV:REDIRECT_STATUS} ^$
49-
RewriteRule ^app\.php(?:/(.*)|$) %{ENV:BASE}/$1 [R=301,L]
49+
RewriteRule ^index\.php(?:/(.*)|$) %{ENV:BASE}/$1 [R=301,L]
5050

5151
# If the requested filename exists, simply serve it.
5252
# We only want to let Apache serve files and not directories.
5353
RewriteCond %{REQUEST_FILENAME} -f
5454
RewriteRule ^ - [L]
5555

5656
# Rewrite all other queries to the front controller.
57-
RewriteRule ^ %{ENV:BASE}/app.php [L]
57+
RewriteRule ^ %{ENV:BASE}/index.php [L]
5858
</IfModule>
5959

6060
<IfModule !mod_rewrite.c>
6161
<IfModule mod_alias.c>
6262
# When mod_rewrite is not available, we instruct a temporary redirect of
6363
# the start page to the front controller explicitly so that the website
6464
# and the generated links can still be used.
65-
RedirectMatch 302 ^/$ /app.php/
65+
RedirectMatch 302 ^/$ /index.php/
6666
# RedirectTemp cannot be used instead
6767
</IfModule>
6868
</IfModule>

public/index.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
use PhpList\Core\Core\Bootstrap;
6+
use PhpList\Core\Core\Environment;
7+
8+
require dirname(__DIR__) . '/vendor/autoload.php';
9+
10+
$environment = $_ENV['APP_ENV'] ?? $_SERVER['APP_ENV'] ?? getenv('APP_ENV') ?: Environment::PRODUCTION;
11+
12+
$bootstrap = Bootstrap::getInstance();
13+
if ($environment !== Environment::PRODUCTION) {
14+
$bootstrap->ensureDevelopmentOrTestingEnvironment();
15+
}
16+
17+
$bootstrap
18+
->setEnvironment($environment)
19+
->configure()
20+
->dispatch();

src/Bounce/Service/Handler/BlacklistEmailAndDeleteBounceHandler.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
use PhpList\Core\Bounce\Service\Manager\BounceManager;
88
use PhpList\Core\Bounce\Service\SubscriberBlacklistService;
9+
use PhpList\Core\Domain\Messaging\Model\BounceAction;
910
use PhpList\Core\Domain\Subscription\Service\Manager\SubscriberHistoryManager;
1011
use Symfony\Contracts\Translation\TranslatorInterface;
1112

@@ -30,7 +31,7 @@ public function __construct(
3031

3132
public function supports(string $action): bool
3233
{
33-
return $action === 'blacklistemailanddeletebounce';
34+
return $action === BounceAction::BlacklistEmailAndDeleteBounce->value;
3435
}
3536

3637
public function handle(array $closureData): void

src/Bounce/Service/Handler/BlacklistEmailHandler.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
namespace PhpList\Core\Bounce\Service\Handler;
66

77
use PhpList\Core\Bounce\Service\SubscriberBlacklistService;
8+
use PhpList\Core\Domain\Messaging\Model\BounceAction;
89
use PhpList\Core\Domain\Subscription\Service\Manager\SubscriberHistoryManager;
910
use Symfony\Contracts\Translation\TranslatorInterface;
1011

@@ -26,7 +27,7 @@ public function __construct(
2627

2728
public function supports(string $action): bool
2829
{
29-
return $action === 'blacklistemail';
30+
return $action === BounceAction::BlacklistEmail->value;
3031
}
3132

3233
public function handle(array $closureData): void

src/Bounce/Service/Handler/BlacklistUserAndDeleteBounceHandler.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
use PhpList\Core\Bounce\Service\Manager\BounceManager;
88
use PhpList\Core\Bounce\Service\SubscriberBlacklistService;
9+
use PhpList\Core\Domain\Messaging\Model\BounceAction;
910
use PhpList\Core\Domain\Subscription\Service\Manager\SubscriberHistoryManager;
1011
use Symfony\Contracts\Translation\TranslatorInterface;
1112

@@ -30,7 +31,7 @@ public function __construct(
3031

3132
public function supports(string $action): bool
3233
{
33-
return $action === 'blacklistuseranddeletebounce';
34+
return $action === BounceAction::BlacklistUserAndDeleteBounce->value;
3435
}
3536

3637
public function handle(array $closureData): void

src/Bounce/Service/Handler/BlacklistUserHandler.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
namespace PhpList\Core\Bounce\Service\Handler;
66

77
use PhpList\Core\Bounce\Service\SubscriberBlacklistService;
8+
use PhpList\Core\Domain\Messaging\Model\BounceAction;
89
use PhpList\Core\Domain\Subscription\Service\Manager\SubscriberHistoryManager;
910
use Symfony\Contracts\Translation\TranslatorInterface;
1011

@@ -26,7 +27,7 @@ public function __construct(
2627

2728
public function supports(string $action): bool
2829
{
29-
return $action === 'blacklistuser';
30+
return $action === BounceAction::BlacklistUser->value;
3031
}
3132

3233
public function handle(array $closureData): void

0 commit comments

Comments
 (0)