feat: send replies to assignment mailings to the travel management inbox
This commit is contained in:
1 parent
74080b0488
commit
2c51ddf86f
5 files changed
+13
-9
No files matched your search
@@ -70,6 +70,10 @@ APP_BPN_CRM_ID_TEAMER=1070
|
|||||||
APP_DEFAULT_EMAIL_FROM=[email protected]
|
APP_DEFAULT_EMAIL_FROM=[email protected]
|
||||||
APP_DEFAULT_EMAIL_TO=[email protected]
|
APP_DEFAULT_EMAIL_TO=[email protected]
|
||||||
|
|
||||||
|
# Reply-To of every mail of an assignment mailing, so answers reach the shared inbox rather
|
||||||
|
# than the manager who happened to send it.
|
||||||
|
APP_ASSIGNMENT_MAILING_REPLY_TO=[email protected]
|
||||||
|
|
||||||
# Regular expressions of the only recipients a mail may actually reach. Everything else is
|
# Regular expressions of the only recipients a mail may actually reach. Everything else is
|
||||||
# stripped from the envelope and a mail left without a recipient is not sent at all, see
|
# stripped from the envelope and a mail left without a recipient is not sent at all, see
|
||||||
# App\EventListener\EmailRecipientWhitelistSubscriber. Empty means no filtering, which is what
|
# App\EventListener\EmailRecipientWhitelistSubscriber. Empty means no filtering, which is what
|
||||||
|
|||||||
@@ -78,6 +78,7 @@ parameters:
|
|||||||
|
|
||||||
default_email_from: '%env(APP_DEFAULT_EMAIL_FROM)%'
|
default_email_from: '%env(APP_DEFAULT_EMAIL_FROM)%'
|
||||||
default_email_to: '%env(APP_DEFAULT_EMAIL_TO)%'
|
default_email_to: '%env(APP_DEFAULT_EMAIL_TO)%'
|
||||||
|
assignment_mailing_reply_to: '%env(APP_ASSIGNMENT_MAILING_REPLY_TO)%'
|
||||||
|
|
||||||
# Per deployment and not per environment: staging and production run the same compiled
|
# Per deployment and not per environment: staging and production run the same compiled
|
||||||
# environment and differ only in their .env.local. The csv processor turns an unset
|
# environment and differ only in their .env.local. The csv processor turns an unset
|
||||||
@@ -204,6 +205,7 @@ services:
|
|||||||
$seasonTaskDeadlineOffset: '%season_task_deadline_offset%'
|
$seasonTaskDeadlineOffset: '%season_task_deadline_offset%'
|
||||||
$autoAssignmentJobProfiles: '%auto_assignment_job_profiles%'
|
$autoAssignmentJobProfiles: '%auto_assignment_job_profiles%'
|
||||||
$autoAssignmentFees: '%auto_assignment_fees%'
|
$autoAssignmentFees: '%auto_assignment_fees%'
|
||||||
|
$assignmentMailingReplyTo: '%assignment_mailing_reply_to%'
|
||||||
|
|
||||||
# Tagged by interface rather than listed by hand: order between collectors is
|
# Tagged by interface rather than listed by hand: order between collectors is
|
||||||
# irrelevant, so the only thing an explicit list could add here is the chance to
|
# irrelevant, so the only thing an explicit list could add here is the chance to
|
||||||
|
|||||||
@@ -17,8 +17,8 @@ use App\Model\TeamerMailingRecipientsDto;
|
|||||||
* finally sent, so a queued mailing never carries their content.
|
* finally sent, so a queued mailing never carries their content.
|
||||||
*
|
*
|
||||||
* With $listColleagues every mail ends with the names and addresses of the other recipients,
|
* With $listColleagues every mail ends with the names and addresses of the other recipients,
|
||||||
* taken from the same snapshot. $replyTo is the sender's address, kept here because the worker
|
* taken from the same snapshot. $replyTo is decided when the mailing is queued, so a deploy
|
||||||
* has no logged-in user to ask.
|
* that changes it does not reroute answers to a mailing already on its way.
|
||||||
*/
|
*/
|
||||||
class SendTeamerMailing
|
class SendTeamerMailing
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ class AssignmentMailingService
|
|||||||
private readonly EntityManagerInterface $entityManager,
|
private readonly EntityManagerInterface $entityManager,
|
||||||
private readonly MessageBusInterface $messageBus,
|
private readonly MessageBusInterface $messageBus,
|
||||||
private readonly LoggerInterface $logger,
|
private readonly LoggerInterface $logger,
|
||||||
|
private readonly string $assignmentMailingReplyTo,
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -123,8 +124,8 @@ class AssignmentMailingService
|
|||||||
$recipients,
|
$recipients,
|
||||||
$this->attachmentHandler->toMessageAttachments($attachments),
|
$this->attachmentHandler->toMessageAttachments($attachments),
|
||||||
listColleagues: true,
|
listColleagues: true,
|
||||||
// answers go to whoever wrote the mailing, not to the app's sender address
|
// answers go to the travel management inbox, not to the app's sender address
|
||||||
replyTo: $sender->getEmail()
|
replyTo: $this->assignmentMailingReplyTo
|
||||||
));
|
));
|
||||||
|
|
||||||
$this->logger->info('Send assignment mailing', [
|
$this->logger->info('Send assignment mailing', [
|
||||||
|
|||||||
+2
-5
@@ -38,8 +38,6 @@ class AssignmentMailingControllerTest extends WebTestCase
|
|||||||
|
|
||||||
private JobProfile $jobProfile;
|
private JobProfile $jobProfile;
|
||||||
|
|
||||||
private User $sender;
|
|
||||||
|
|
||||||
protected function setUp(): void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
$this->client = static::createClient(server: ['HTTPS' => true]);
|
$this->client = static::createClient(server: ['HTTPS' => true]);
|
||||||
@@ -220,8 +218,8 @@ class AssignmentMailingControllerTest extends WebTestCase
|
|||||||
$this->assertSame('/administrative/assignment', $this->client->getResponse()->headers->get('HX-Redirect'));
|
$this->assertSame('/administrative/assignment', $this->client->getResponse()->headers->get('HX-Redirect'));
|
||||||
$this->assertEmailCount(1);
|
$this->assertEmailCount(1);
|
||||||
$this->assertSame('Hallo Anna', trim((new Crawler($this->getMailerMessage()->getHtmlBody()))->filter('p')->first()->text()));
|
$this->assertSame('Hallo Anna', trim((new Crawler($this->getMailerMessage()->getHtmlBody()))->filter('p')->first()->text()));
|
||||||
// answers reach the manager who sent it
|
// answers reach the travel management inbox, not the manager who sent it
|
||||||
$this->assertSame($this->sender->getEmail(), $this->getMailerMessage()->getReplyTo()[0]->getAddress());
|
$this->assertSame('[email protected]', $this->getMailerMessage()->getReplyTo()[0]->getAddress());
|
||||||
// alone in the mailing, so nobody to list
|
// alone in the mailing, so nobody to list
|
||||||
$this->assertStringNotContainsString('Deine Kolleg:innen', (string) $this->getMailerMessage()->getHtmlBody());
|
$this->assertStringNotContainsString('Deine Kolleg:innen', (string) $this->getMailerMessage()->getHtmlBody());
|
||||||
|
|
||||||
@@ -399,7 +397,6 @@ class AssignmentMailingControllerTest extends WebTestCase
|
|||||||
$this->entityManager->flush();
|
$this->entityManager->flush();
|
||||||
|
|
||||||
$this->client->loginUser($user);
|
$this->client->loginUser($user);
|
||||||
$this->sender = $user;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private function assignment(string $hotel): Assignment
|
private function assignment(string $hotel): Assignment
|
||||||
|
|||||||
Reference in new issue
Block a user