Skip to content

Commit f4c6993

Browse files
TatevikGrtatevikg1
andauthored
Bounce regex management, Subscriber blacklist, Subscribe pages management (#159)
- [Blacklist](ad52a60) - [Subscribepage](3b839be) - [Bounceregex](5b7835d) - [Add: Reset subscriber bounce count](2748491) - [Move em->flush to controllers](#160) - Add regex pattern validation --------- Co-authored-by: Tatevik <[email protected]>
1 parent 3ca5387 commit f4c6993

File tree

60 files changed

+2360
-361
lines changed

Some content is hidden

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

60 files changed

+2360
-361
lines changed

.coderabbit.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
2+
language: "en-US"
3+
tone_instructions: "chill"
4+
reviews:
5+
profile: "chill"
6+
high_level_summary: true
7+
collapse_walkthrough: true
8+
suggested_labels: false
9+
high_level_summary_in_walkthrough: false
10+
changed_files_summary: false
11+
poem: false
12+
auto_review:
13+
enabled: true
14+
base_branches:
15+
- ".*"
16+
drafts: false

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 1 addition & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,3 @@
1-
### Summary
2-
3-
Provide a general description of the code changes in your pull request …
4-
were there any bugs you had fixed? If so, mention them. If these bugs have open
5-
GitHub issues, be sure to tag them here as well, to keep the conversation
6-
linked together.
7-
8-
9-
### Unit test
10-
11-
Are your changes covered with unit tests, and do they not break anything?
12-
13-
You can run the existing unit tests using this command:
14-
15-
vendor/bin/phpunit tests/
16-
17-
18-
### Code style
19-
20-
Have you checked that you code is well-documented and follows the PSR-2 coding
21-
style?
22-
23-
You can check for this using this command:
24-
25-
vendor/bin/phpcs --standard=PSR2 src/ tests/
26-
27-
28-
### Other Information
29-
30-
If there's anything else that's important and relevant to your pull
31-
request, mention that information here. This could include benchmarks,
32-
or other information.
33-
34-
If you are updating any of the CHANGELOG files or are asked to update the
35-
CHANGELOG files by reviewers, please add the CHANGELOG entry at the top of the file.
1+
"@coderabbitai summary"
362

373
Thanks for contributing to phpList!

composer.json

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@
2929
"role": "Maintainer"
3030
}
3131
],
32+
"repositories": [
33+
{
34+
"type": "vcs",
35+
"url": "https://github.com/TatevikGr/rss-bundle.git"
36+
}
37+
],
3238
"support": {
3339
"issues": "https://github.com/phpList/rest-api/issues",
3440
"forum": "https://discuss.phplist.org/",
@@ -41,7 +47,8 @@
4147
"symfony/test-pack": "^1.0",
4248
"symfony/process": "^6.4",
4349
"zircote/swagger-php": "^4.11",
44-
"ext-dom": "*"
50+
"ext-dom": "*",
51+
"tatevikgr/rss-feed": "dev-main as 0.1.0"
4552
},
4653
"require-dev": {
4754
"phpunit/phpunit": "^10.0",
@@ -123,5 +130,10 @@
123130
}
124131
}
125132
}
133+
},
134+
"config": {
135+
"allow-plugins": {
136+
"php-http/discovery": true
137+
}
126138
}
127139
}

config/services/managers.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,19 @@ services:
2020
autowire: true
2121
autoconfigure: true
2222

23-
PhpList\Core\Domain\Messaging\Service\MessageManager:
23+
PhpList\Core\Domain\Messaging\Service\Manager\MessageManager:
2424
autowire: true
2525
autoconfigure: true
2626

27-
PhpList\Core\Domain\Messaging\Service\TemplateManager:
27+
PhpList\Core\Domain\Messaging\Service\Manager\TemplateManager:
2828
autowire: true
2929
autoconfigure: true
3030

31-
PhpList\Core\Domain\Messaging\Service\TemplateImageManager:
31+
PhpList\Core\Domain\Messaging\Service\Manager\TemplateImageManager:
32+
autowire: true
33+
autoconfigure: true
34+
35+
PhpList\Core\Domain\Messaging\Service\Manager\BounceRegexManager:
3236
autowire: true
3337
autoconfigure: true
3438

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
services:
2+
PhpList\Core\Domain\Messaging\MessageHandler\CampaignProcessorMessageHandler:
3+
autowire: true
4+
autoconfigure: true
5+
public: false

config/services/normalizers.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,3 +93,15 @@ services:
9393
PhpList\RestBundle\Statistics\Serializer\TopLocalPartsNormalizer:
9494
tags: [ 'serializer.normalizer' ]
9595
autowire: true
96+
97+
PhpList\RestBundle\Subscription\Serializer\UserBlacklistNormalizer:
98+
tags: [ 'serializer.normalizer' ]
99+
autowire: true
100+
101+
PhpList\RestBundle\Subscription\Serializer\SubscribePageNormalizer:
102+
tags: [ 'serializer.normalizer' ]
103+
autowire: true
104+
105+
PhpList\RestBundle\Messaging\Serializer\BounceRegexNormalizer:
106+
tags: [ 'serializer.normalizer' ]
107+
autowire: true

src/Identity/Controller/AdminAttributeDefinitionController.php

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

55
namespace PhpList\RestBundle\Identity\Controller;
66

7+
use Doctrine\ORM\EntityManagerInterface;
78
use OpenApi\Attributes as OA;
89
use PhpList\Core\Domain\Identity\Model\AdminAttributeDefinition;
910
use PhpList\Core\Domain\Identity\Service\AdminAttributeDefinitionManager;
@@ -32,7 +33,8 @@ public function __construct(
3233
RequestValidator $validator,
3334
AdminAttributeDefinitionManager $definitionManager,
3435
AdminAttributeDefinitionNormalizer $normalizer,
35-
PaginatedDataProvider $paginatedDataProvider
36+
PaginatedDataProvider $paginatedDataProvider,
37+
private readonly EntityManagerInterface $entityManager,
3638
) {
3739
parent::__construct($authentication, $validator);
3840
$this->definitionManager = $definitionManager;
@@ -89,6 +91,8 @@ public function create(Request $request): JsonResponse
8991
$definitionRequest = $this->validator->validate($request, CreateAttributeDefinitionRequest::class);
9092

9193
$attributeDefinition = $this->definitionManager->create($definitionRequest->getDto());
94+
$this->entityManager->flush();
95+
9296
$json = $this->normalizer->normalize($attributeDefinition, 'json');
9397

9498
return $this->json($json, Response::HTTP_CREATED);
@@ -156,6 +160,7 @@ public function update(
156160
attributeDefinition: $attributeDefinition,
157161
attributeDefinitionDto: $definitionRequest->getDto(),
158162
);
163+
$this->entityManager->flush();
159164
$json = $this->normalizer->normalize($attributeDefinition, 'json');
160165

161166
return $this->json($json, Response::HTTP_OK);
@@ -211,6 +216,7 @@ public function delete(
211216
}
212217

213218
$this->definitionManager->delete($attributeDefinition);
219+
$this->entityManager->flush();
214220

215221
return $this->json(null, Response::HTTP_NO_CONTENT);
216222
}

src/Identity/Controller/AdminAttributeValueController.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
namespace PhpList\RestBundle\Identity\Controller;
66

7+
use Doctrine\ORM\EntityManagerInterface;
78
use OpenApi\Attributes as OA;
89
use PhpList\Core\Domain\Identity\Model\Filter\AdminAttributeValueFilter;
910
use PhpList\Core\Domain\Identity\Model\Administrator;
@@ -27,18 +28,21 @@ class AdminAttributeValueController extends BaseController
2728
private AdminAttributeManager $attributeManager;
2829
private AdminAttributeValueNormalizer $normalizer;
2930
private PaginatedDataProvider $paginatedDataProvider;
31+
private EntityManagerInterface $entityManager;
3032

3133
public function __construct(
3234
Authentication $authentication,
3335
RequestValidator $validator,
3436
AdminAttributeManager $attributeManager,
3537
AdminAttributeValueNormalizer $normalizer,
36-
PaginatedDataProvider $paginatedDataProvider
38+
PaginatedDataProvider $paginatedDataProvider,
39+
EntityManagerInterface $entityManager,
3740
) {
3841
parent::__construct($authentication, $validator);
3942
$this->attributeManager = $attributeManager;
4043
$this->normalizer = $normalizer;
4144
$this->paginatedDataProvider = $paginatedDataProvider;
45+
$this->entityManager = $entityManager;
4246
}
4347

4448
#[Route(
@@ -122,6 +126,7 @@ public function createOrUpdate(
122126
definition: $definition,
123127
value: $request->toArray()['value'] ?? null
124128
);
129+
$this->entityManager->flush();
125130
$json = $this->normalizer->normalize($attributeDefinition, 'json');
126131

127132
return $this->json($json, Response::HTTP_CREATED);
@@ -193,6 +198,7 @@ public function delete(
193198
throw $this->createNotFoundException('Administrator attribute not found.');
194199
}
195200
$this->attributeManager->delete($attribute);
201+
$this->entityManager->flush();
196202

197203
return $this->json(null, Response::HTTP_NO_CONTENT);
198204
}
@@ -350,6 +356,7 @@ public function getAttributeDefinition(
350356
attributeDefinitionId: $definition->getId()
351357
);
352358
$this->attributeManager->delete($attribute);
359+
$this->entityManager->flush();
353360

354361
return $this->json(
355362
$this->normalizer->normalize($attribute),

src/Identity/Controller/AdministratorController.php

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

55
namespace PhpList\RestBundle\Identity\Controller;
66

7+
use Doctrine\ORM\EntityManagerInterface;
78
use OpenApi\Attributes as OA;
89
use PhpList\Core\Domain\Identity\Model\Administrator;
910
use PhpList\Core\Domain\Identity\Service\AdministratorManager;
@@ -35,7 +36,8 @@ public function __construct(
3536
RequestValidator $validator,
3637
AdministratorManager $administratorManager,
3738
AdministratorNormalizer $normalizer,
38-
PaginatedDataProvider $paginatedProvider
39+
PaginatedDataProvider $paginatedProvider,
40+
private readonly EntityManagerInterface $entityManager,
3941
) {
4042
parent::__construct($authentication, $validator);
4143
$this->administratorManager = $administratorManager;
@@ -149,6 +151,7 @@ public function createAdministrator(
149151
$createRequest = $validator->validate($request, CreateAdministratorRequest::class);
150152

151153
$administrator = $this->administratorManager->createAdministrator($createRequest->getDto());
154+
$this->entityManager->flush();
152155
$json = $normalizer->normalize($administrator, 'json');
153156

154157
return $this->json($json, Response::HTTP_CREATED);
@@ -255,6 +258,7 @@ public function updateAdministrator(
255258
/** @var UpdateAdministratorRequest $updateRequest */
256259
$updateRequest = $this->validator->validate($request, UpdateAdministratorRequest::class);
257260
$this->administratorManager->updateAdministrator($administrator, $updateRequest->getDto());
261+
$this->entityManager->flush();
258262

259263
return $this->json($this->normalizer->normalize($administrator), Response::HTTP_OK);
260264
}
@@ -303,6 +307,7 @@ public function deleteAdministrator(
303307
throw $this->createNotFoundException('Administrator not found.');
304308
}
305309
$this->administratorManager->deleteAdministrator($administrator);
310+
$this->entityManager->flush();
306311

307312
return $this->json(null, Response::HTTP_NO_CONTENT);
308313
}

src/Identity/Controller/PasswordResetController.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
namespace PhpList\RestBundle\Identity\Controller;
66

7+
use Doctrine\ORM\EntityManagerInterface;
78
use OpenApi\Attributes as OA;
89
use PhpList\Core\Domain\Identity\Service\PasswordManager;
910
use PhpList\Core\Security\Authentication;
@@ -29,6 +30,7 @@ public function __construct(
2930
Authentication $authentication,
3031
RequestValidator $validator,
3132
PasswordManager $passwordManager,
33+
private readonly EntityManagerInterface $entityManager,
3234
) {
3335
parent::__construct($authentication, $validator);
3436

@@ -74,6 +76,7 @@ public function requestPasswordReset(Request $request): JsonResponse
7476
$resetRequest = $this->validator->validate($request, RequestPasswordResetRequest::class);
7577

7678
$this->passwordManager->generatePasswordResetToken($resetRequest->email);
79+
$this->entityManager->flush();
7780

7881
return $this->json(null, Response::HTTP_NO_CONTENT);
7982
}
@@ -117,6 +120,7 @@ public function validateToken(Request $request): JsonResponse
117120
$validateRequest = $this->validator->validate($request, ValidateTokenRequest::class);
118121

119122
$administrator = $this->passwordManager->validatePasswordResetToken($validateRequest->token);
123+
$this->entityManager->flush();
120124

121125
return $this->json([ 'valid' => $administrator !== null]);
122126
}
@@ -169,6 +173,7 @@ public function resetPassword(Request $request): JsonResponse
169173
$resetRequest->token,
170174
$resetRequest->newPassword
171175
);
176+
$this->entityManager->flush();
172177

173178
if ($success) {
174179
return $this->json([ 'message' => 'Password updated successfully']);

0 commit comments

Comments
 (0)