1
0
mirror of https://framagit.org/tykayn/date-poll-api synced 2023-08-25 08:23:11 +02:00

create a poll sends a mail to owner

This commit is contained in:
Baptiste Lemoine 2020-04-16 18:06:43 +02:00
parent fe59537bc6
commit f6da68997d
2 changed files with 22 additions and 1 deletions

View File

@ -85,4 +85,25 @@ class FramadateController extends AbstractController {
return 1; return 1;
} }
/**
* @param Owner $foundOwner
* @param Poll|null $poll
*
* @throws \Symfony\Component\Mailer\Exception\TransportExceptionInterface
*/
public function sendCreationMailAction( Owner $foundOwner, Poll $poll = null ) {
// anti spam , limit to every minute TODO
$config = [
'owner' => $foundOwner,
'from' => 'ne-pas-repondre@framadate-api.cipherbliss.com',
'poll' => $poll,
'title' => 'Création de sondage - ' . ( $poll ? $poll->getTitle() : $poll ),
'email_template' => 'emails/creation-mail.html.twig',
];
return $this->sendMailWithVars( $config );
}
} }

View File

@ -227,7 +227,7 @@ class PollController extends FramadateController {
$precision = 'from an existing user : ' . $foundOwner->getEmail(); $precision = 'from an existing user : ' . $foundOwner->getEmail();
} }
$this->mail_service->sendCreationMailAction( $foundOwner, $newpoll ); $this->sendCreationMailAction( $foundOwner, $newpoll );
return $this->json( [ return $this->json( [
'message' => 'you created a poll ' . $precision, 'message' => 'you created a poll ' . $precision,