-
Notifications
You must be signed in to change notification settings - Fork 13
release: dev → main (add forwarding, attachments, open tracking) #165
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
5658321
Add forward email endpoint (#164)
TatevikGr 1419d83
After review 0
tatevikg1 cd8139f
Add tests
tatevikg1 8b1e424
Core from dev branch
tatevikg1 1be4006
Feat: attachement endpoint (#166)
TatevikGr aacaf11
Feat: track message view (#167)
TatevikGr 65d3e3f
Add: get subscribers endpoint
tatevikg1 18d6b17
Fix test
tatevikg1 f49ce4e
Update guzzle version to ^7.2 add filter
tatevikg1 e5667e8
Subscriber filter in get subscribers endpoint
tatevikg1 fe79ae1
PaginatedResult
tatevikg1 9907f4e
Remove sorting
tatevikg1 953c350
Add: get auth user endpoint
tatevikg1 b879fc6
Add: history to subscriber object
tatevikg1 595fa6f
Allow origin frontend
tatevikg1 8801ad9
Remove additionalData property from UpdateSubscriberRequest
tatevikg1 97d5bbd
Add dashboard_statistics
tatevikg1 ddaf6bd
Add more data to dashboard_statistics
tatevikg1 462128a
Add: PaginatedFilter
tatevikg1 2943771
getLists with SubscriberListFilter
tatevikg1 646326b
Add: update list endpoint
tatevikg1 ff05834
Add: owner check to subscription endpoints
tatevikg1 7f54de3
Fix: listId validator
tatevikg1 86c72fa
Fix: tests
tatevikg1 5eb4ac1
Add: fields to export
tatevikg1 3ffdae8
Export: confirmed, blacklisted filters
tatevikg1 1c4d23d
Import: Add autoConfirm property
tatevikg1 ba61d06
Add: send_start to response campaign
tatevikg1 c675bca
Add: as_text as_html
tatevikg1 f26a1b7
Add: resend_campaign endpoint
tatevikg1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,19 @@ | ||
| services: | ||
| PhpList\RestBundle\Subscription\Service\SubscriberService: | ||
| PhpList\RestBundle\Subscription\Service\SubscriberHistoryService: | ||
| autowire: true | ||
| autoconfigure: true | ||
|
|
||
| PhpList\RestBundle\Subscription\Service\SubscriberHistoryService: | ||
| PhpList\Core\Domain\Messaging\Service\ForwardingGuard: | ||
| autowire: true | ||
| autoconfigure: true | ||
| public: false | ||
|
|
||
| PhpList\Core\Domain\Messaging\Service\ForwardDeliveryService: | ||
| autowire: true | ||
| autoconfigure: true | ||
| public: false | ||
|
|
||
| PhpList\Core\Domain\Messaging\Service\ForwardContentService: | ||
| autowire: true | ||
| autoconfigure: true | ||
| public: false |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,121 @@ | ||
| <?php | ||
|
|
||
| declare(strict_types=1); | ||
|
|
||
| namespace PhpList\RestBundle\Messaging\Controller; | ||
|
|
||
| use Doctrine\ORM\EntityManagerInterface; | ||
| use OpenApi\Attributes as OA; | ||
| use PhpList\Core\Domain\Messaging\Model\Dto\MessageForwardDto; | ||
| use PhpList\Core\Domain\Messaging\Model\Message; | ||
| use PhpList\Core\Domain\Messaging\Service\MessageForwardService; | ||
| use PhpList\Core\Security\Authentication; | ||
| use PhpList\RestBundle\Common\Controller\BaseController; | ||
| use PhpList\RestBundle\Common\Validator\RequestValidator; | ||
| use PhpList\RestBundle\Messaging\Request\ForwardMessageRequest; | ||
| use PhpList\RestBundle\Messaging\Serializer\ForwardingResultNormalizer; | ||
| use Symfony\Bridge\Doctrine\Attribute\MapEntity; | ||
| use Symfony\Component\HttpFoundation\JsonResponse; | ||
| use Symfony\Component\HttpFoundation\Request; | ||
| use Symfony\Component\HttpFoundation\Response; | ||
| use Symfony\Component\Routing\Attribute\Route; | ||
|
|
||
| /** | ||
| * This controller provides REST API for email forwarding | ||
| * | ||
| * @author Tatevik Grigoryan <tatevik@phplist.com> | ||
| */ | ||
| #[Route('/email-forward', name: 'email_forward_')] | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
| class EmailForwardController extends BaseController | ||
| { | ||
| public function __construct( | ||
| Authentication $authentication, | ||
| RequestValidator $validator, | ||
| private readonly EntityManagerInterface $entityManager, | ||
| private readonly MessageForwardService $messageForwardService, | ||
| private readonly ForwardingResultNormalizer $forwardingResultNormalizer, | ||
| ) { | ||
| parent::__construct($authentication, $validator); | ||
| } | ||
|
|
||
| #[Route('/{messageId}', name: 'forward', requirements: ['messageId' => '\\d+'], methods: ['POST'])] | ||
| #[OA\Post( | ||
| path: '/api/v2/campaigns/{messageId}/forward', | ||
| description: '🚧 **Status: Beta** – This method is under development. Avoid using in production. ' . | ||
| 'Queues forwarding of a campaign/message to provided recipient emails.', | ||
| summary: 'Forward a message to recipients.', | ||
| requestBody: new OA\RequestBody( | ||
| description: 'Forwarding payload', | ||
| required: true, | ||
| content: new OA\JsonContent(ref: '#/components/schemas/ForwardMessageRequest') | ||
| ), | ||
| tags: ['campaigns'], | ||
| parameters: [ | ||
| new OA\Parameter( | ||
| name: 'php-auth-pw', | ||
| description: 'Session key obtained from login', | ||
| in: 'header', | ||
| required: true, | ||
| schema: new OA\Schema(type: 'string') | ||
| ), | ||
| new OA\Parameter( | ||
| name: 'messageId', | ||
| description: 'message ID', | ||
| in: 'path', | ||
| required: true, | ||
| schema: new OA\Schema(type: 'string') | ||
| ) | ||
| ], | ||
| responses: [ | ||
| new OA\Response( | ||
| response: 202, | ||
| description: 'Accepted', | ||
| content: new OA\JsonContent(ref: '#/components/schemas/ForwardResult') | ||
| ), | ||
| new OA\Response( | ||
| response: 403, | ||
| description: 'Failure', | ||
| content: new OA\JsonContent(ref: '#/components/schemas/UnauthorizedResponse') | ||
| ), | ||
| new OA\Response( | ||
| response: 404, | ||
| description: 'Failure', | ||
| content: new OA\JsonContent(ref: '#/components/schemas/NotFoundErrorResponse') | ||
| ), | ||
| new OA\Response( | ||
| response: 422, | ||
| description: 'Failure', | ||
| content: new OA\JsonContent(ref: '#/components/schemas/ValidationErrorResponse') | ||
| ) | ||
| ] | ||
| )] | ||
| public function forwardMessage( | ||
| Request $request, | ||
| #[MapEntity(mapping: ['messageId' => 'id'])] ?Message $message = null | ||
| ): JsonResponse { | ||
| if ($message === null) { | ||
| throw $this->createNotFoundException('Campaign not found.'); | ||
| } | ||
|
|
||
| /** @var ForwardMessageRequest $forwardRequest */ | ||
| $forwardRequest = $this->validator->validate($request, ForwardMessageRequest::class); | ||
|
|
||
| $result = $this->messageForwardService->forward( | ||
| messageForwardDto: new MessageForwardDto( | ||
| emails: $forwardRequest->recipients, | ||
| uid: $forwardRequest->uid, | ||
| fromName: $forwardRequest->fromName, | ||
| fromEmail: $forwardRequest->fromEmail, | ||
| note: $forwardRequest->note, | ||
| ), | ||
| campaign: $message, | ||
| ); | ||
|
|
||
| $this->entityManager->flush(); | ||
|
|
||
| return $this->json( | ||
| $this->forwardingResultNormalizer->normalize($result), | ||
| Response::HTTP_ACCEPTED | ||
| ); | ||
| } | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.